Thanks regulus6633 for the tip. http://macscripter.net/viewtopic.php?id=33933
My script keeps progressing. After running the script I came to mind that I would have to be more cautious before emptying the card. Especially since, at the beginning, the files are only stored on the card.
I’ve decided when duplicating the card information I would do it onto two different hard drives. The first one being the computer hard drive and then en external FW800 drive.
However, I still have the problem to ensure all files located on SDHC card have been copied over.
The workflow will then be the following:
1 - Copy all files stored on the SDHC card onto the computer hard drive;
2 - Verify if all the files copied onto the computer hard drive are equal to the one stored on the SDHC card;
3 - Copy verified files from the computer hard drive to the external hard drive;
4 - Verify again the files copied over form the computer hard drive are equal to the one located on the external hard drive;
5 - Move all files located on the external hard drive to their correct location i.e using the name NIK001* NIK002* create a subfolder 01 for all files starting with NIK001*, create a subfolder 02 for all files starting with NIK002*
6 - Delete all files located on the SDHC card;
7 - Eject the card and notify the operator.
At this moment my script is performing correctly steps #1, #3, #6 and #7.
Step #5 I have sufficient information, the tip provided by regulus6633 pointed me on the right direction, I should be able to efficiently write this function.
Step #2 and #4, I am currently programming and having difficulties.
I wish comparing the variables theCardFile with theDumpFile would have been sufficient. This does not seem to be the case. I believe what is happening is that those variables not only contains the filenames but also the path describing were they were coming from.
- If this is the case is there a quick function which would allow me to remove path and rebuilt the array for comparisons.
I am trying to see the content of those two variables in doing a display dialog. This does not work I get an error message.
- Would someone know how to display the content of those variable onto the screen?
- Am i on the right track by comparing the variable theCardFile to theDumpFiles?
Thanks again!
Daniel
set destinationFolder to (path to home folder as text) & "NIKON:dumpNIKON:"
display dialog destinationFolder
tell application "Finder"
set inputFolder to folder "DCIM:" of disk "NIKON" as string
set theCardFiles to files of folder inputFolder whose name begins with "NIK001"
set theDumpFiles to files of folder destinationFolder whose name begins with "NIK001"
duplicate theCardFiles to folder destinationFolder with replacing
if theDumpFiles is equal to the theCardFiles then
display dialog "Files copied on the hard drive are identical to the one stored on the SDHC card. You can now remove all files starting with NIK001 located on the SDHC card"
else
display dialog "Files copied on the hard drive are not identical to the one stored on the SDHC card. NOthing will be removed from the SDHC card"
end if
end tell