• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Moving Files by Mod date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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.

References: 
 >Moving Files by Mod date (From: Neal Colston <email@hidden>)

  • Prev by Date: RE: Calling Applications
  • Next by Date: Re: Name of current users home folder (OS X)
  • Previous by thread: Moving Files by Mod date
  • Next by thread: "missing value" in GUI scripting
  • Index(es):
    • Date
    • Thread