Steven D'Aprano
2015-05-21 14:39:32 UTC
Hi,
I would like to hide .pyc and .pyo files because they are visually
distracting. Is the aforementioned command the best way? [1].
It isn't clear what you mean by "hide them".I would like to hide .pyc and .pyo files because they are visually
distracting. Is the aforementioned command the best way? [1].
If you mean that you want to use the ls command to get a directory
listing, but just not see the .pyc files, then all you need is:
ls *.py
which will list the .py files and nothing else.
You can remove the .pyc and .pyo files, or move them elsewhere:
rm *.py[co]
mv *.py[co] some/other/directory/
and let Python recreate them as needed.
If you're using a GUI file manager, there may be an option to hide
certain files. I know that KDE 3, at least, hides files starting with a
leading dot, and backup files ending with ~ so it's quite likely that
there's a way to hide .pyc and .pyo files. Check the documentation for
your GUI file manager.
The command you give:
ls *.py[co] >> .hidden
doesn't hide anything. It lists the .pyc and .pyo files, but rather than
printing to the terminal, it appends them to a file called .hidden in
the current directory.
Ah, wait, I see! Nautilus uses the .hidden file to suppress the display
of those files.
I wonder whether putting a single line:
.*py[co]
inside .hidden will work? You need to try it, or ask a Gnome expert.
--
Steve
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor
Steve
_______________________________________________
Tutor maillist - ***@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor