Moving all files??

Hi there - sorry if this is yet another newby question but is there a command to open a folder, select all files, copy them to a new location and the delete the origional files?

I have this so far but it doesn’t work!!!

tell application “Finder”
open folder “users:gboyle:desktop:test1”
select every item
copy
open “users:gboyle:desktop:test2”
paste
display dialog “All files have been copied”
end tell

Many thanks for any help - can anyone recommend a good applecript reference book???

Here’s what I come up with. You definitely need to be careful if you are using this because of deleting files. It will just move the files to the trash I believe unless you tell it to empty trash also. Anyway here it goes…

tell application "Finder"
	set fold_path to folder "Macintosh HD G52:Users:admin2:Desktop:test1:"
	set fold_path2 to folder "Macintosh HD G52:Users:admin2:Desktop:test2:"
	duplicate every folder of fold_path to fold_path2 -- add (with replacing) if you want to replace the folders that may already be in your destination folder.
	select every folder of fold_path
	delete selection
end tell

I forgot to say to be sure that in your file path (Macintosh HD G52:Users: and so on) that you make sure that all folders/disks/files are typed in using the same case. Also if your path ends with a : it signifies a folder - without one applescript will be looking for a file.

Worked a treat! I also changed “duplicate every folder” to “duplicate every file” and this moves the lot!

Thanks again!

You’re welcome. Something else I thought of. If you’re going to move these files to another drive you’ll have to look up the syntax for having the script wait for a specified amount of time. I belive it was something like

delay 300

where the number is the number of seconds applescript will wait while a file is being transfered. Applescript only gives 60 seconds for an instruction to complete. If a file transfer is in progress and doesn’t complete in that time your script will give an error. Someone else may have the exact syntax for this.