RE: Removable Disks
RE: Removable Disks
- Subject: RE: Removable Disks
- From: Jay Young <email@hidden>
- Date: Sat, 8 Nov 2003 16:30:00 -0600
Hi Christopher,
Well, this is kind of rough, so you'll probably want to edit it some,
but hopefully it will be of some help. Instead of naming the folder in
numbers (like 11082003) I got a little lazy and just named them with
their month as text (like November 8, 2003). The below code runs as a
'stay open' application and when it sees that a disk's been loaded then
it looks for a folder on the Desktop with the date (or creates one) and
then copies all the items (files, folders, etc.) to the date folder and
then ejects the disk when it's done. I loaded a CD and firewire drive
at the same time and it seemed to work decently (on OS 10.3). Notice
though that if you're trying to copy a file into the date folder over
another file with the same name then the script will error. You'll
probably want to add some 'try' statements, etc.
Jay
------------------------------------
on idle {}
tell application "Finder"
tell (disks whose ejectable is true)
if it exists then my copyPhotos(it's name)
end tell
end tell
return 60
end idle
on copyPhotos(pics)
set desktopPath to (path to desktop) as string
tell (current date) to set d to (it's month & " " & day & ", " & year)
as string
tell application "Finder"
if not (exists (folder (desktopPath & d))) then
make new folder at folder desktopPath with properties {name:d}
end if
repeat with x in pics
with timeout of 600 seconds
move disk x's items to folder (desktopPath & d)
end timeout
eject disk x
end repeat
end tell
end copyPhotos
------------------------------------
===============================================
Subject:
Re: Removable Disks
To:
email@hidden
From:
email@hidden (Christopher Rosado)
Date:
Sat, 8 Nov 2003 13:47:32 -0500
Chris-
Yes, I do want something to constantly watch for mounted volumes.
Here's what I'm trying to accomplish:
I have a situation where several photographers will need to transfer
their photos from CF card to computer @ regular intervals.
The idea is to have a central workstation where these photogs can pop
in their CF card and have the system automatically detect that the card
has been mounted, copy the images to a specific location.
The "copy to" location would be set by date- the script would look for
a folder on the desktop that reflects the current date (for instance,
"11082003". If the folder is not found, the script would create it. If
found, the images would be copied to that folder. This works out well
because it allows me to easily sort photos by date through the folders
and by time within the folders. I have the portion of the script that
creates the folder completed.
It looks as if I could even have the disk eject automatically once the
copying is complete. This would be great- the goal is to automate the
entire process and keep this completely "hands off" regarding the
photogs...
--Christopher
_______________________________________________
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.