0

This list will then be used to create tar balls for easy movement. This is what I came up with so far. Add up files that are just greater than 10GB list them to file.

find .  -type f -exec ls -al {} + | awk '{ total += $5 }; {print $9}; {if (total > 10000000000) {print total; total = 0  }}; END { print total }' > /tmp/testfile.txt

What I would like to do name each tar ball with a unique name but I am putting all results in the /tmp/testfile.txt

Tried this but seems a little cumbersome.

find . -type f -exec ls -al {} + | awk '{ filenumber };{ total += $5 }; {print $9}; {if (total > 10000000000) {print total; total = 0; filenumber++;print "This is filenumber"filenumber".tar" }}; END { print total }' > /tmp/testfile.txt

This is what I came up with -

 find ./ -type f -exec ls -al {} + | awk 'BEGIN { filenumber };{ total += $5 }; {print $9 > "filename"filenumber".txt"}; {if (total > 10000000000) {print total; total = 0; filenumber++;print "This is filename"filenumber".txt" }}; END { print total }' > filecheck.txt

After that command I feed results to this command.

for file in $( find . -name "filename*.txt" -type f );do tar -cvf "$file.tar" -T "$file"; done
LCJ
  • 1

0 Answers0