TECH TRANSIT : IF YOU LOVE TECHNOLOGY , YOU'LL LOVE US

Find files accroding to size and archive them

Spread the love

Here is a bash script for find all files which size is higher than given size in parameter and archive it.

Find below example.

Server Support

 

files=$(find ./ -type f -size +$1c)
#fix names in case there are spaces. Insert \ to escape spaces
techtrname="${files// /\\ }"
tar -czf techtransit.tar.gz $techtrname

Spread the love

Have any Question or Comment?

Leave a Reply




Tech Transit Facebook Page

SuperWebTricks Loading...