Duplicating files and folders

Hello,

I do have files contained on an SDHC card that I want to copy onto an external hard drive.

The SDHC card name is SANDISK and the external drive name is NX5U.

The input files to be copied are under the following path:
MP_ROOT:101PNV01

The output folder where the files need to be copied over is
MP_ROOT:101PNV01

I wrote this simple script and do have an error message. Could someone tell me what I’ve done wrong.

Many thanks!
Daniel

tell application "Finder"
	with timeout of 0 seconds
		-- SDHC card folder (input)
		set sourceFolder to folder "MP_ROOT:101PNV01:" of disk "SANDISK" as string
		set theCardFiles to files of folder sourceFolder
		
		-- External disk (output)	
		set ExternalCurrentComp to "Volumes:NX5U:MP_ROOT:101PNV01:"
		
		duplicate theCardFiles to folder ExternalCurrentComp with replacing
	end timeout
end tell
return

Hi,

try this


tell application "Finder"
	with timeout of 0 seconds
		-- SDHC card folder (input)
		set theCardFiles to files of folder "SANDISK:MP_ROOT:101PNV01:"
		
		-- External disk (output)    
		set ExternalCurrentComp to folder "NX5U:MP_ROOT:101PNV01:"
		
		duplicate theCardFiles to ExternalCurrentComp with replacing
	end timeout
end tell

Hello Stefan,

Unfortunately, I get an error message -8082 on the duplicate command.

I’ve made sure the path of the SDHC card and the external drive are correct.

tell application "Finder"
	with timeout of 0 seconds
		-- SDHC card folder (input)
		set theCardFiles to files of folder "SANDISK:MP_ROOT:101PNV01"
		
		-- External disk (output) 
		set ExternalCurrentComp to folder "NX5U:MP_ROOT:101PNV01:"
		
		try
			duplicate theCardFiles to ExternalCurrentComp with replacing
		on error the error_message number the error_number
			display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
		end try
		
	end timeout
end tell
return

I have some déjà vu

http://macscripter.net/viewtopic.php?id=39983
http://macscripter.net/viewtopic.php?id=35232

the code is correct, the error must come from somewhere else.

Thanks Stefan,

You are right about the “some déja vu” and I really appreciate your help.

Unfortunately, I had to react to a logistic changes which occurred late yesterday afternoon (last minutes changes, not under my control). Usually I would spent way more time on my own to fix the code. Time is running out on me, I need to get ready by tomorrow and this is why I’ve posted this problem to get help from the forum.

The code which I’ve submitted yesterday came from those “déja vu”. I’ve made minor changes which came with errors.

The good new is tha the “déja vu” code is sill often being used and is running without a flaw.

I will dig further and try to see what the problem is with those three lines of code, if I not capable to fix it I still have a plan B which is to perform those actions manually.

Error -8082 is really not obvious, let say it does not mean anything.

Could the fact the SDHC card is used via the Macbook Pro port and the external drive is connected through a USB port on the MacBook Pro make a difference ?

With regards!
Daniel