|
|
find ?
Here is what I have in my crontab:
I use 'access time' as a reference (penultimate letter in
find ?
Nice cron, but why "-mindepth 1 -maxdepth 1" ?
find ?
find ?
Thanks, I'll be adding this tonight!
find ?
Couldn't get it to work in crontab, but I was successful id creating a launchd LaunchAgent. Great tip, nice and simple. No need for a program or long script. Thanks!
If interested, the launchd script is: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <plist version="1.0"> <dict> <key>Disabled</key> <true/> <key>Label</key> <string>com.tony.DeleteTrash7DaysOld</string> <key>ProgramArguments</key> <array> <string>/usr/bin/find</string> <string>/Users/Tony/.Trash</string> <string>-mindepth</string> <string>1</string> <string>-maxdepth</string> <string>1</string> <string>-newerat</string> <string>-not</string> <string>7 days ago</string> <string>-delete</string> </array> <key>RunAtLoad</key> <true/> <key>ServiceDescription</key> <string>DeleteTrash7DaysOld</string> </dict> </plist>
find ?
Nice too, though I'm surprised it did not work in cron :(
find ?
Not sure why I couldn't get cron to work. It should have, but while trying to figure out the problem I leaned that Apple has depreciated cron since 10.4 in favor of launchd (a google or wiki will give background on this). Lingo, a nice freeware app, is helpful in writing launchd playlists. One advantage of using launchd over cron is that I can specify RunAtLoad (good for me as I have a laptop that I don't keep running 24/7)
find ?
I noticed an error.
find ?
wow. that's great.
find ?
find is a UNIX command locate in the usr/bin/ directory. When running cron or launchd you need the absolute path, hence usr/bin/find. To learn more about find, enter "man find" in Terminal
find ?
My trashed folders weren't deleting. It looks like find is changing the access time. changing -newerat to -newermt fixed that problem, but I guess if I trash a file without modifying it that it will get deleted sooner than anticipated.
find ?
This is strange, for me it works flawlessly and a
ls -latu .Trash/ shows that the access time of my Trashed files did not change... could the problem be related to the launchd trick ?
What happens if you just type the command in a Terminal ? (check access times before and after, do they change ?).---
find ?
Same at the command line:
find ?
Ok, I finally got it : for me it works because find doesn't change the atime of files but changes that of directories !!!
The solution ? Change
---
find ?
I had already tried -prune without success:
find ?
I run OSX 10.4.10, however if I didn't notice the problem it is probably because I didn't have any directory in my Trash, only "flat" files (and for them no access time change)...
To solve the directories problem something like the following might work : But it doesn't seem to work as I expected (-or problem ?), whereas separating the two commands does what it should... ---
find ?
Actually I discovered that the problem is caused by
-delete so changing it to use rm seems ok.
Here is my new crontab entry :
DISCLAIMER: use --- |
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.09 seconds |
|