Differences between revisions 2 and 3
Revision 2 as of 2013-06-04 22:32:23
Size: 457
Editor: SamatJain
Comment: Replace text in all files in & under the current directory
Revision 3 as of 2013-08-09 21:18:38
Size: 807
Editor: SamatJain
Comment:
Deletions are marked like this. Additions are marked like this.
Line 18: Line 18:
=== Find files NOT named something ===

{{{#!highlight sh numbers=off
# Find files matching a pattern that are NOT already compressed, then compress them
# (This particular example compresses Maildirs for use w/ dovecot's transparent decompression)
find . -type f -name '*S=*' -not -name '*.gz' -print0 | xargs -0 -P4 -n 16 zopfli -l100
}}}

Delete files not modified in n days

Useful for clearing out caches that aren't properly cleaned out otherwise.

# Delete files not modified in 30 days
find /path/to/files* -mtime +30 -exec rm {} \;

Replace text in all files in & under the current directory

find . -type f -exec sed -i 's/old/new/g' {} \;

Find files NOT named something

# Find files matching a pattern that are NOT already compressed, then compress them
# (This particular example compresses Maildirs for use w/ dovecot's transparent decompression)
find . -type f -name '*S=*' -not -name '*.gz' -print0 | xargs -0 -P4 -n 16 zopfli -l100


CategoryCheatSheet

SamatsWiki: CheatSheet/GNUFind (last edited 2019-01-13 22:01:38 by SamatJain)