11

I would like to hide every .pyc file from Nautilus. I use Ubuntu 10.04.

What could I do?

2
  • It sounds like you're trying to solve a completely different problem which has nothing to do with hiding files at all. Oct 18, 2010 at 17:32
  • "rm -r *.pyc" would "hide" all those pesky files and free up some space at the same time. Pity they'd reappear next time you ran the program.
    – Mokubai
    Oct 18, 2010 at 17:32

4 Answers 4

6

One option would be to not create these files at all. See this thread https://stackoverflow.com/questions/154443/how-to-avoid-pyc-files

You can also quickly delete these files from Nautilus by pressing ctrl+s, entering *.pyc pattern and hitting delete key.

0
10

Just need to open a bash terminal and run:

ls *.py[co] >> .hidden

bingo!

5

You can add all the .pyc filenames to a .hidden file in the same directory. Requires some maintenance, but if you're like me you do a lot more modifying of existing files than creating new ones.

1
  • Does this work on Mac OS or only Linux ?
    – Nivir
    Jun 10, 2014 at 8:01
-1

I have read all the answers under this question and created a simple script to automate the task:

https://github.com/neatsoft/nautilus-hide-pyc

It allows to hide temporary Python files in the GNOME Files (Nautilus). Searches for the pyc/pyo files recursively and puts it to the .hidden files.

#!/usr/bin/env bash

hide() {
  for d in *.py[co]; do
    if [ -f "$d" ]; then
      echo $d
    fi
  done | tee "$(pwd)/.hidden" > /dev/null
}

recursive() {
  for d in *; do
    if [ -d "$d" ]; then
      (cd -- "$d" && hide)
      (cd -- "$d" && recursive)
    fi
  done
}

(recursive)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .