I am new to shell scripting. I am trying to write a cron  for unix shell that will delete some files, say after 2 weeks or after 1 month from a specific directory./somedir1/somedir2/if(somedir2) contains file with extension .txt or .log thencheck timestampif two weeks old delete itotherwise don't delete.Any help in this regard will be appreciated.
Cron to delete particular file(s) from a specific directory
shell;files;cron
Try the find command.find /somedir1/somedir2 -name *.txt -name *.log -mtime 2w -deleteChange -delete to -print for a dry run.