zvtral
July 14, 2011, 10:23pm
1
hlow all
i have folder with name like this
20110512
20110601
20110602
so i want move the last 1 day to other directory for example this date 20110602 so i want move folder older 1 day from this date
20110512 -----> this folder will move to other dir
20110601-----> this folder will move to other dir
20110602--->this still here cause is current now
what shoud i do for this case:confused:
zvtral:
hlow all
i have folder with name like this
20110512
20110601
20110602
so i want move the last 1 day to other directory for example this date 20110602 so i want move folder older 1 day from this date
20110512 -----> this folder will move to other dir
20110601-----> this folder will move to other dir
20110602--->this still here cause is current now
what shoud i do for this case:confused:
What you need to move..? If its files then post few sample file-names to get an idea how your file looks like. If not please detail your objective.
you can try something like below
prevdate=`date -d '1 day ago' +%Y%m%d`;
find <search_path> -name $prevdate -type d ! -newermt `date +%Y%m%d` -exec mv -f '{}' <destination_dir> \;