|
|
Or use a more appropriate tool for the job.
Or you could just use a one-liner from the commandline. To delete files:
To list files:
To move to trash:
To look for files older than 30 days, change the 14 to a 30. To look for files that have been modified in LESS THAN 30 days, change the + to a -. To find out more about what you can do with find, run "man find". To make a shell script out of any of those, make a file that contains this line:
Followed by one of the above lines, and where you see "Downloads", substitute in "$1". Save the file, do chmod +x filename, and you're off. The script will take the directory to operate on as a parameter.
No offense intended, but Ruby simply isn't the right tool for this particular job. It's an excellent language, and it excels in many areas but shell environments and the dozens of little utilities that support them were created precisely for handling these sorts of tasks and they do so very well with far less effort. -JF
Or use a more appropriate tool for the job.
Yes, but find is not restricted to only removing whole root level directories. That was my first solution, though.
Or use a more appropriate tool for the job.
Not sure *entirely* what you mean, but look in your find manpage for -maxdepth and -type. It may not be called -maxdepth in Tiger's 'find' (one of the bad things about 'standard' command-line utils is that they differ across platforms.) It may be necessary to do this in a couple of lines, which would mean a shellscript, but that's certainly OK.
Or use a more appropriate tool for the job.
Any chance you could post the script? I have been tinkering with something like this for a while but to no avail (no shell scripting experience).
Or use a more appropriate tool for the job.
I use the following command to clean out old home folders on multi-user workstations: |
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysNo new commentsLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.11 seconds |
|