I use latex in my work a lot. Compiling a latex file generates a lot of intermediate files with .log, .aux extensions. To avoid clutter, I would like to hide these intermediate files. Is there a way to hide files based on their extension?
Asked
Active
Viewed 723 times
1 Answers
1
Edit, I also came across this: https://igurublog.wordpress.com/downloads/mod-pcmanfm/
I am not to familiar with PCManFM since I don't use a GUI, but if you ctrl + r
to run a command in directory you should then be able to run my command below to hide the files.
To show hidden files, you just need to hit ctrl+h
.
You could try something like this if you are interested in an approach outside of PCManFM:
find . \( -name "*.log" -o -name "*.aux" \) -exec sh -c 'mv "$1" ."${1#./}"' _ {} \;
Basically I am looking for any file in the current directly that ends with .log
or .aux
and renaming by adding a .
in front of the name to make it a hidden file. I do a string substitution to strip out the ./
from the filename before the move otherwise it will try to move the file up a directory by appending the .
to ./
creating ../
.
Before:
# ls -lh
total 0
-rw-r--r--. 1 root root 0 Feb 7 16:26 alt2.file
-rw-r--r--. 1 root root 0 Feb 7 16:27 alt3.alt
-rw-r--r--. 1 root root 0 Feb 7 16:27 alt4.nothing
-rw-r--r--. 1 root root 0 Feb 7 16:26 alt.test
-rw-r--r--. 1 root root 0 Feb 7 16:28 file1.aux
-rw-r--r--. 1 root root 0 Feb 7 16:28 file1.log
-rw-r--r--. 1 root root 0 Feb 7 16:28 file2.aux
-rw-r--r--. 1 root root 0 Feb 7 16:28 file2.log
-rw-r--r--. 1 root root 0 Feb 7 16:28 file3.aux
-rw-r--r--. 1 root root 0 Feb 7 16:28 file3.log
After:
# ls -lh
total 0
-rw-r--r--. 1 root root 0 Feb 7 16:26 alt2.file
-rw-r--r--. 1 root root 0 Feb 7 16:27 alt3.alt
-rw-r--r--. 1 root root 0 Feb 7 16:27 alt4.nothing
-rw-r--r--. 1 root root 0 Feb 7 16:26 alt.test
# ls -lha ## Add 'a' to see hidden files
total 8.0K
drwxr-xr-x. 2 root root 4.0K Feb 7 16:39 .
dr-xr-x---. 4 root root 4.0K Feb 7 16:35 ..
-rw-r--r--. 1 root root 0 Feb 7 16:26 alt2.file
-rw-r--r--. 1 root root 0 Feb 7 16:27 alt3.alt
-rw-r--r--. 1 root root 0 Feb 7 16:27 alt4.nothing
-rw-r--r--. 1 root root 0 Feb 7 16:26 alt.test
-rw-r--r--. 1 root root 0 Feb 7 16:28 .file1.aux
-rw-r--r--. 1 root root 0 Feb 7 16:28 .file1.log
-rw-r--r--. 1 root root 0 Feb 7 16:28 .file2.aux
-rw-r--r--. 1 root root 0 Feb 7 16:28 .file2.log
-rw-r--r--. 1 root root 0 Feb 7 16:28 .file3.aux
-rw-r--r--. 1 root root 0 Feb 7 16:28 .file3.log

Rui F Ribeiro
- 56,709
- 26
- 150
- 232

devnull
- 5,431
-
I had problems installing pcmanfm-mod, and found that its development isn't supported any more. But I liked your idea of writing a small script. Thanks! – elexhobby Feb 07 '15 at 23:13