Zipping files in a directory with 'too many files'

Sometimes you can hit the problem where there are too many files in a directory for the normal commands like:

gzip *

to work

To get round this there are 2 ways of doing it:

The first is:
find . -mtime +60 -exec gzip {} \;

The second is:
for files in `ls`
do
gzip $files
done

(note: you must use the correct quotes and have do/done on separate lines as above for the second example)

0 comments:

Post a Comment