macvsog has asked for the
wisdom of the Perl Monks concerning the following question:
I'm just starting to try and learn Perl, but it's a sort of trial by fire situation. I need to create a script right away, to resolve a problem. Were I doing this in the Windows environment instead of Unix, I'd already have the script done and compiled (because in Windows, I use the Winbatch scripting language). But I'm still learning shell scripting, let alone Perl. So I could use a little help. My question is one as two whether or not Perl has the necessary functions for me to be able to create the script in perl. I've been through the built-in function list and I don't see much in the way of file manipulation functions or date/time functions.
I need to create a perl script (or a shell script, if it's possible to do it that way, using the tcsh shell) that will examine the contents of the /var/backups/repository directory, find all files and directories that have a name that begins with the characters DATE_ , determine which ones of those it finds are more than two weeks old, and delete the ones that are more than two weeks old. If they are directories, it would first have to delete all the files in that directory and then delete the directory.
Can anyone point me in the right direction?