Reference:
http://stackoverflow.com/questions/5142429/unix-how-to-delete-files-listed-in-a-file
http://itigloo.com/how-do-i/binrm-argument-list-too-long-error/
Uses command: rm -rf `find . -name *.tr[0-9]* -print` and gets ‘/bin/rm: Argument list too long’ error.
Solution 1:
/usr/bin/find /home -mtime +7 -name *.tr[0-9]* -print > /root/list.txt
for f in $(cat /root/list.txt); do
rm $f
done
Solution 2:
/usr/bin/find /home -mtime +7 -name *.tr[0-9]* -print | xargs rm
沒有留言:
張貼留言