Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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?

In reply to How do I find and delete files based on age? by macvsog

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2024-04-25 06:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found