Hiding files of a certain extension (.pyc) from Nautilus

8

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

What could I do?

juanefren

Posted 2010-10-18T17:29:04.080

Reputation: 287

It sounds like you're trying to solve a completely different problem which has nothing to do with hiding files at all. – Ignacio Vazquez-Abrams – 2010-10-18T17:32:05.933

"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 – 2010-10-18T17:32:11.180

Answers

5

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.

Paweł Nadolski

Posted 2010-10-18T17:29:04.080

Reputation: 966

8

Just need to open a bash terminal and run:

ls *.py[co] >> .hidden

bingo!

Farsheed

Posted 2010-10-18T17:29:04.080

Reputation: 191

4

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.

Karl Bielefeldt

Posted 2010-10-18T17:29:04.080

Reputation: 1 050

Does this work on Mac OS or only Linux ? – J4cK – 2014-06-10T08:01:16.000

-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)

neatsoft

Posted 2010-10-18T17:29:04.080

Reputation: 1