From Electron Cloud
(7 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
To change every directory to have ug+rwx and [http://www.faqs.org/faqs/hp/hpux-faq/section-70.html sticky]: | To change every directory to have ug+rwx and [http://www.faqs.org/faqs/hp/hpux-faq/section-70.html sticky]: | ||
− | + | find . -type d -print0 | xargs -0 chmod 1770 | |
− | find . -type d -print0 | xargs -0 chmod 1770 | + | |
− | + | ||
-print0 and -0 are to [http://www.linuxdevcenter.com/pub/a/linux/lpt/09_22.html deal with spaces in the filenames]. | -print0 and -0 are to [http://www.linuxdevcenter.com/pub/a/linux/lpt/09_22.html deal with spaces in the filenames]. | ||
+ | |||
+ | For read/write but NOT execute on normal files: | ||
+ | find . -type f -print0 | xargs -0 chmod 0660 | ||
+ | |||
+ | To delete old files (e.g. older than one day): | ||
+ | find . -mtime +1 -exec rm {} \; | ||
+ | |||
+ | To find files, links, etc. but NOT directories, and omit the leading ".": | ||
+ | find –not –type d | sed ‘s/.//’ | ||
+ | |||
+ | Copy files in many subdirectories into a single subdirectory: | ||
+ | find . -name *.mp3 -print0 | xargs -0 -I '{}' mv '{}' the-one-folder | ||
+ | |||
+ | Find source files that were modified today (and a few more file types too): | ||
+ | alias src_mod_today='find . -type f -mtime -1 | grep -v "\.o$" | grep -v "\.so$" | grep -v moc_' |
Latest revision as of 14:23, 28 April 2009
To change every directory to have ug+rwx and sticky:
find . -type d -print0 | xargs -0 chmod 1770
-print0 and -0 are to deal with spaces in the filenames.
For read/write but NOT execute on normal files:
find . -type f -print0 | xargs -0 chmod 0660
To delete old files (e.g. older than one day):
find . -mtime +1 -exec rm {} \;
To find files, links, etc. but NOT directories, and omit the leading ".":
find –not –type d | sed ‘s/.//’
Copy files in many subdirectories into a single subdirectory:
find . -name *.mp3 -print0 | xargs -0 -I '{}' mv '{}' the-one-folder
Find source files that were modified today (and a few more file types too):
alias src_mod_today='find . -type f -mtime -1 | grep -v "\.o$" | grep -v "\.so$" | grep -v moc_'