12

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

What could I do?

amiregelz
  • 8,297
juanefren
  • 327

4 Answers4

10

Just need to open a bash terminal and run:

ls *.py[co] >> .hidden

bingo!

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.

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

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