11

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

What could I do?

amiregelz
  • 8,099
  • 12
  • 48
  • 58
juanefren
  • 317
  • 3
  • 7
  • 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 Oct 18 '10 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 '10 at 17:32

4 Answers4

10

Just need to open a bash terminal and run:

ls *.py[co] >> .hidden

bingo!

Farshid Ashouri
  • 230
  • 2
  • 6
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.

Paweł Nadolski
  • 1,056
  • 5
  • 10
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.

Karl Bielefeldt
  • 1,120
  • 6
  • 14
-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
  • 101
  • 1