Hi,
i have the directory structure
directory /home/ncs/controller/logs/
in this path i have following directories
cl03032010
cl04032010
cl05032010
cl06042010
i want to delete the folders which are 2 weeks old.. through the crontab
Hi,
i have the directory structure
directory /home/ncs/controller/logs/
in this path i have following directories
cl03032010
cl04032010
cl05032010
cl06042010
i want to delete the folders which are 2 weeks old.. through the crontab
first check the manual of find to see if you want to use atime, ctime , mtime .
find . -ctime 14 -exec rm {} \;
Note before using rm do some check with ls to see if the output is what you desired to rm
while adding the entry in the crontab make sure to specify the full path of the commands you use if its not already set
HTH,
PL
i have to do one more thing.
i have directory structure
/home/ncs/payload/logs
in that i have directories like
payload1
payload2
payload3
payload4
payload5
inside this each payload ditectory i have the logs folder which appears like
pl03032010
pl04032010
.
:
:
so i want to make a looping from this directory /home/ncs/payload/logs
where it has to go and check inside each payload directory and delete the log folder which are 2 weeks older.
can you please suggest the safest way to do this ?