Saturday, January 20, 2018

#1 2005-08-31 07:16:11 pm

mjerjohnson
Member
From:: FL
Registered: 2005-09-01
Posts: 1

move to trash, selectively

I've been lookin around/experimenting with Automator quite a bit to find:

a way to monitor a folder (some kind of Folder Action) so that when files are older than a certain amount (IE 14 days), they are moved to the trash.

seems simple enough, but all the queries in Automator don't come near this type of filter.  would i need to incorporate an applescript or a shell script.  i'm vaguely familiar with Applescript (obviously not enough if that's where the answer lies), but not at all with shells.

so, does anyone have any idea how i can solve this?

thanks much,
matt


iBook 600 MHz, 640 RAM, 60 GB HD
OS X 10.4.2

Offline

 

#2 2005-09-16 02:56:29 pm

Trash Man
Sanitation Department
Registered: 2005-10-20
Posts: 5336

Re: move to trash, selectively

I am in a similar position. I have dabbled in AppleScript over the years and I struggled with Automator. After reading your post I stumbled across the following Apple support pages:

www.apple.com/applescript/folderactions/index.html

It talks through creating AppleScripts as parts of folder actions. Now, I'm no AppleScript genius (I can't even remember the syntax) but I'm sure you could take the "file added" folder action example and add something like:

for each file in folder
if date of file is more than 14 days old then delete it

I shall be working on a folder action to remove all but the most recently added file. Good luck with your project.
:-)


One mans trash is another mans treasure

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)