shell - Deleting log directories of a particular timestamp in UNIX -


i want delete directories 5 days old, based on directory name, instead of unix timestamp. let assume directories created test_2013-05-20-12:23:43 , on.

i want delete directories 5 days older, i.e before 16th.

is possible do?

if not specific file name criteria use this

find /path/to/files* -mtime +5 -exec rm {} \; 

note there spaces between rm, {}, , \;

explanation

the first argument path files. can path, directory, or wildcard in example above. recommend using full path, , make sure run command without exec rm make sure getting right results. second argument, -mtime, used specify number of days old file is. if enter +5, find files older 5 days. third argument, -exec, allows pass in command such rm. {} \; @ end required end command.

read link more info


Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -