--Move all current directory(including subdirectory) to other. The files is Modified 7 day before.
find /setup -mtime +7 -exec mv "{}" /new_setup/ \;
--Move only file on current directory(Not including subdirectory) to other. The files is Modified 7 day before.
find /setup/* -prune -type f -mtime +7 -exec ls -alt {} \;
find /setup/* -prune -type f -mtime +7 -exec mv "{}" /setup/setup \;
2/ We use this option when list of files is too long(million files):
if [ $( pwd ) != "/setup" ]
then
cd /setup;
fi;
for v_date in "1" "02" "03" "04" "05" "06" "07" "08" "09" "10" "11" "12" "13" "14" "15" "16" "17" "18" "19" "20" "21" "22" "23" "24" "25" "26" "27" "28" "29" "30"
do
for v_file in $( ls -l | grep "$v_date 2017" | awk '{ print $9 }' )
do
print "Moving $v_file";
mv $v_file /new_setup;
done;
done;
Không có nhận xét nào:
Đăng nhận xét