teracopy like program

Hey everyone.

I’m new to Applescript and have been working through The Missing Manual and AppleScript 1-2-3 but I have not found quite what I’m looking for. Basically I’m trying to code a program that will copy one file to a location and check to make sure it is done copying before it starts the next file. Daily I have to transfer large files (over 140GB) sometimes at the same time and when that happens it kills the transfer speed. So I though I could use a data size check to compare the original file to the one in the new destination. This is what I have even though its not much.

set selectedFiles to (choose file with promt “Select Files to Be Copied” with multiple selection allowed)
set fileDestinaiton to (choose folder with prompt “Selected Where the file is to be copied”)
set fileCount to (count every item in selectedFiles)
tell application “Finder”
activate
set fileSize to size of (info for selectedFiles)
duplicated selectedFiles to fileDestinaion
end tell

I’m not sure how to repeat a check to the file being copied in the new location. any ideas? or does anyone know of a batch copy program like teracopy for mac?

Hi,

Try this:

set selectedFiles to (choose file with prompt "Select Files to Be Copied" with multiple selections allowed)
set fileDestination to (choose folder with prompt "Selected Where the file is to be copied")
set folderPOSIXpath to quoted form of POSIX path of fileDestination
repeat with selectedFile in selectedFiles
	set filePOSIXpath to quoted form of POSIX path of selectedFile
	
	do shell script ("cp  " & filePOSIXpath & " " & folderPOSIXpath)
end repeat

–Peter–

That is awesome. Guess I have been over thinking it a bit.

Thank you so much.

Hi,

I added a logfile to the script so you can see what has been done.
You can change the path and name of the log file to your needs.
changing .txt to .log will ope the file in the app Console.
You can monitor the script by using:

set myhome to path to home folder as string
tell application "Console" to activate
tell application "Console" to open myhome & "Copy_Log.log"

before the repeat block.

set logPath to "~/Copy_Log.txt"
set selectedFiles to (choose file with prompt "Select Files to Be Copied" with multiple selections allowed)
set fileDestination to (choose folder with prompt "Selected Where the file is to be copied")
set folderPOSIXpath to quoted form of POSIX path of fileDestination
repeat with selectedFile in selectedFiles
	tell application "Finder" to set filename to (name of selectedFile)
	set filePOSIXpath to quoted form of POSIX path of selectedFile
	
	do shell script ("cp  " & filePOSIXpath & " " & folderPOSIXpath)
	set theDate to (current date) as text
	do shell script "echo " & quoted form of filename & " was copied to " & fileDestination & "   " & theDate & ">>" & logPath
end repeat

Have fun,

Peter