I really do not know why the code is not working. Everything is OK up the last duplicate, I get an applescript errormessage.
Nikon is a SDHC card
Gandaf (at this moment) is a USB key drive. Later on it will be an external hard drive connected through firewire.
Regards!
Daniel
set HomeFolder to (path to home folder as text)
set pathFolder1Name to "FPAQ"
set pathFolder2Name to "PROD"
set pathFolder3Name to "MPEGfiles"
tell application "Finder"
with timeout of 0 seconds
if not (exists folder (HomeFolder & pathFolder1Name & ":" & pathFolder3Name)) then
if not (exists folder (HomeFolder & pathFolder1Name)) then
make new folder at folder HomeFolder with properties {name:pathFolder1Name}
set createdDir to pathFolder1Name
end if
make new folder at folder (HomeFolder & pathFolder1Name) with properties {name:pathFolder3Name}
set createdDir to pathFolder1Name & pathFolder3Name
display dialog "Please note the folder " & createdDir & " has been created"
end if
set DestinationFolder to (path to home folder as text) & pathFolder1Name & ":" & pathFolder3Name & ":"
my VerifyMountedDisk("the SDHC NIKON card", "NIKON")
set inputFolder to folder "MP_ROOT:101PNV01:" of disk "NIKON" as string
set theCardFiles to files of folder inputFolder
duplicate theCardFiles to folder DestinationFolder with replacing
my VerifyMountedDisk("the external hard drive Gandalf", "Gandalf")
set backupMPGFolder to folder "backupMPG:" of disk "Gandalf" as string
set theCardFiles to files of folder DestinationFolder
duplicate theCardFiles to folder backupMPGFolder with replacing
end timeout
end tell
on VerifyMountedDisk(Media, theDisk)
set mounteddisks to list disks
repeat until mounteddisks contains theDisk
set mounteddisks to list disks
display dialog "Please insert " & Media & " in the computer"
end repeat
end VerifyMountedDisk
At a glance, assuming disk “Gandolf” is valid, the line
set backupMPGFolder to folder “backupMPG:” of disk “Gandalf” as string
has a colon in the folder name that shouldn’t be there (that can’t be the name of the folder). Not sure what the “as string” refers to either.
Thanks Adam,
I’ve removed the colon and still have a problem. The reason why I am putting as string is because if I do not do that I get a error message about the statement being an integer.
Each time I run the script as a first dump on Gandalf everything works. As soon there as been one dump the other time it does not work.
I’ve tried and deleting the folder “backupMPG” from Gandalf and run the script again, it worked without any problems. Next time it does not work.
Remove the folder, run it and works, run it again it does not work.
Bizarre really bizarre!
P.S I changed the code a bit.
Regards!
Daniel
set HomeFolder to (path to home folder as text)
set pathFolder1Name to "FPAQ"
set pathFolder2Name to "MPEGfiles"
set DestinationFolder to (path to home folder as text) & "FPAQ:DestMPEG:"
set filePath to DestinationFolder & logname
tell application "Finder"
with timeout of 0 seconds
if not (exists folder (HomeFolder & pathFolder1Name & ":" & pathFolder2Name)) then
if not (exists folder (HomeFolder & pathFolder1Name)) then
make new folder at folder HomeFolder with properties {name:pathFolder1Name}
set createdDir to pathFolder1Name
end if
make new folder at folder (HomeFolder & pathFolder1Name) with properties {name:pathFolder2Name}
set createdDir to pathFolder1Name & pathFolder2Name
display dialog "Please note the folder " & createdDir & " has been created"
end if
set DestinationFolder to (path to home folder as text) & pathFolder1Name & ":" & pathFolder2Name & ":"
display dialog "-" & DestinationFolder & "-"
my VerifyMountedDisk("the SDHC card NIKON", "NIKON")
set sourceFolder to folder "MP_ROOT:101PNV01:" of disk "NIKON" as string
set theCardFiles to files of folder sourceFolder
duplicate theCardFiles to folder DestinationFolder with replacing
my VerifyMountedDisk("the external hard drive Gandalf", "Gandalf")
set backupMPGFolder to folder "backupMPG" of disk "Gandalf" as string
set theCardFiles to files of folder DestinationFolder
duplicate theCardFiles to folder backupMPGFolder with replacing
end timeout
end tell
on VerifyMountedDisk(Media, theDisk)
set mounteddisks to list disks
repeat until mounteddisks contains theDisk
set mounteddisks to list disks
display dialog "Please insert " & Media & " in the computer"
end repeat
end VerifyMountedDisk