Re: Sorting files, making folders
Re: Sorting files, making folders
- Subject: Re: Sorting files, making folders
- From: Emmanuel <email@hidden>
- Date: Thu, 1 May 2003 10:45:25 +0200
At 7:41 PM +1200 01/05/03, David Hood wrote:
>
On Thursday, May 1, 2003, at 06:58 PM, Steen Villumsen wrote:
>
>Here's the deal, I have a lot (about 700) images with names like:
>
>
>
>A12345-06
>
>The last two digits in the filename refers to a pagenumber.
>
>
>
>Now here's the tricky part (well, tricky for a newbie like myself). I wan't
>
>my script to make a folder called "Page 01" and put all the files whose name
>
>ends with 01 in there.
>
>
>
>
Well, as a start (and putting aside if there are .whatever suffixes and the effect they might have), here is a snippet for working out the folder to go to from a single file name end:
>
>
set anyOldFile to (choose file) as string
>
set destinationFolderName to "Page " & (characters -2 through -1 of anyOldFile as string)
>
return destinationFolderName
At some point you will need also to test if a folder exists and if it does not to make it:
------------------------- untested
set theFName to "01"
set theRootPath to (path to desktop as text)
set theCandidatePath to theRootPath & theFName
try
alias theCandidatePath
-- it exists
-- tell app "Finder" to move alias [thefile] to [thefolder]
on error -- the folder does not exist
tell application "Finder" to make new folder with properties {name:theFName} at alias theRootPath
end
-----------------------------
Emmanuel
_______________________________________________
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.