문제

I have several directories with files of various sizes. I would like to archive only those files over 100 megabytes in size. Any ideas of a simple command line argument to do this?

도움이 되었습니까?

해결책

Like this

find . -size +100M -exec gzip {} \;

If you are thinking of running it regularly, you may wish to exclude already gzipped files like this

find . ! -name "*.gz" -size +100M -exec gzip {} \;

And if you have lots of big files and (say) a quad core CPU, you could do 4 at a time like this

find . -size +100M | xargs -n 1 -P 4 gzip

다른 팁

Check out the -size option to the find command.

Documentation: find(1)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top