find files less 46 bytes and delete
/usr/bin/find /share/team/ -maxdepth 5 -type f -size -46 -print | xargs rm -f
Recursively remove all empty directories
find . -type d -empty -delete
/usr/bin/find /share/teamleads/ -type d -empty -delete
/usr/bin/find /home/ -type d -empty -delete
find files more than 3 weeks old and delete
/usr/bin/find /share/teamleads/ -maxdepth 4 -type f -mtime +21 -print | xargs rm -f
recursively copy folders with timestamps
cp -vr –preserve=timestamps 2015-11-03 Archive/2015
Get yesterday date
date –date=”yesterday” ‘+%Y-%m-%d’
yestdate=`date –date=”yesterday” ‘+%Y-%m-%d’`;
cp -vr –preserve=timestamps $yestdate Archive/2015
yes | cp -vr –preserve=timestamps $yestdate Archive/2015
cp -vr –preserve=timestamps /home/marskarthik/$yestdate /home/Archive
cp -vr –preserve=timestamps /home/2015-11-15 /home/Archive