Script does not work anymore

Would someone have an idea this does not work anymore ?

the input files are coming from the folder backMPG of an external disk called GIMLI

The files are to be copied on folder : /Users/UserName/FPAQ/MPEGfiles/

This always worked before, it no longer does.

The duplicate function does not work and I just do not seem to be able to figure it out.

MANY THANKS for your help!

Daniel

GIMLI used to be a SDHC card called NX5U
It is now the name of an external hard drive connected to the USB port. Does it make a difference ?


set pathFolder1Name to "FPAQ"
set pathFolder2Name to "MPEGfiles"
set DestinationFolder to (path to home folder as text) & pathFolder1Name & ":" & pathFolder2Name & ":"
set POSIXdestinationFolder to POSIX path of DestinationFolder

set cardMPEGFolder to "backupMPG"
set cardVolume to "GIMLI"
set GIMLIFolder to "Volumes:" & cardVolume & ":" & cardMPEGFolder & ":"
set POSIXGIMLIfolder to POSIX path of GIMLIFolder

tell application "Finder"
	with timeout of 0 seconds
		
		my VerifyMountedDisk("le disque externe " & cardVolume, cardVolume)
		set SourceFolder to folder cardMPEGFolder of disk cardVolume as string
		set theCardFiles to files of folder SourceFolder
		
		try
			duplicate theCardFiles to folder DestinationFolder with replacing
		on error
			display dialog "IMPORTANT - Error when copying files from GIMLI"
			return
		end try
		
	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 & " to the computer"
	end repeat
end VerifyMountedDisk

What are you trying to accomplish by using with timeout of 0 seconds? You’re basically telling your script to error if the Finder commands aren’t completed in 0 seconds. That doesn’t make sense. You can read the applescript language guide to learn how to use that type of statement here.

HFS paths start always with a disk name even when specifying the startup volume,
for example assuming there is a startup volume “MacHD” and an external disk “External”.
The HFS paths are “MacHD:” and “External:”
the POSIX paths are “/” and “/Volumes/External/”


.
set GIMLIFolder to "cardVolume & ":" & cardMPEGFolder & ":"
.

Thanks everybody.

Stefan, I still get an error -8082 with the duplicate command.

I agree with you that does not make sense. However, when executing the duplicate command most of the time I was getting an “event timed out” error. In putting 0 seconds this did not happened not even once. I sure do not understand why I would stop getting “event timed out” like I did not understand why I was getting this type of error when putting 300, 600 seconds…

I was really surprised to find that out, since it had resolved the problem I left it there.

Daniel

another problem could be the double referencing


 set SourceFolder to folder cardMPEGFolder of disk cardVolume as string
 set theCardFiles to files of folder SourceFolder

Sourcefolder is defined as a Finder folder specifier, so omit the keyword folder in the second line


 set SourceFolder to folder cardMPEGFolder of disk cardVolume
 set theCardFiles to files of SourceFolder

Edit: I overlooked the as string coercion in the first line,
it’s actually not needed

Stefan,

By the time you’ve responded to me I got it to work with the following Do shell script command

set theCardFiles to files of SourceFolder

I’ve tried and got the error “Can’t get every file of "GIMLI:backupMPG:".” number -1728 from every file of “GIMLI:backupMPG:”

Daniel