Re: Moving Files by Mod date
Re: Moving Files by Mod date
- Subject: Re: Moving Files by Mod date
- From: Ben Waldie (AppleScript Guru) <email@hidden>
- Date: Sat, 1 Feb 2003 22:58:47 -0500
Neal,
On Saturday, February 1, 2003, at 05:54 PM, Neal Colston wrote:
>
I'm trying to get the Finder to move files that have been modified the
>
day the script is run into a new folder with the date's name.
Try the following...
-- Set up the target folder
set targetFolder to (choose folder with prompt "Choose a folder of
files to process:") as string
-- Get the name of the date folder
set todayString to date string of (current date)
-- Get the current day, at 12AM
set todayDate to date todayString
tell application "Finder"
-- Get all of the files in the folder
set theFiles to every file of folder targetFolder whose name !A
todayString
-- Make sure that the date folder exists
set destinationfolder to (targetFolder & todayString & ":") as string
if (folder destinationfolder exists) = false then
make new folder at folder targetFolder with properties
{name:todayString}
end if
-- Make a list of all of the files that were modified today
set theNewfiles to {}
repeat with a from 1 to count theFiles
set cFile to item a of theFiles
set cModifiedDate to modification date of cFile
if cModifiedDate !C todayDate then
set end of theNewfiles to cFile
end if
end repeat
-- Move the list of files to the date folder
move theNewfiles to folder destinationfolder
end tell
Good luck,
- Ben
Benjamin S. Waldie
AppleScript Guru
AppleScript Info -
http://www.applescriptguru.com
AppleScript Training -
http://www.applescripttraining.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.