How to move files

How can I move our Network Files which have 1000’s upon 1000’s of other files inside these main files?

Can this be done?
We want to take every file and move them to a New location and get ride of the old location all together.

I’m new to apple script so I want to clear this up before attempting anything. (We CANNOT have a ERROR where it DELETES, DESTROYS, CORRUPTS or Heaven Forbid it Makes any MISTAKES.)

If you have Knowledge of How To, or if there is a Scripted already floating around that is TESTED and Solid, Please link it.

I’ve never used Apple Script before so I don’t know how to write the code, if anyone can point out anything useful please do so.

Thank you for your time!:smiley:

Model: 2.4GHz Intel iMAC, ATI 2600 HD 256Mb Video Card, 2GHz of Ram, 320 GB Hard Drive.
AppleScript: Snow Leopard 10.6.2
Browser: Safari 531.21.10
Operating System: Mac OS X (10.6)

Moving files is a very common task so there are an incredible amount of posts on this forum already. You should find all the information you need by doing a search.

You might also want to look at Unscripted. There are many tutorials there for learning AppleScript.

Hi,

A solution might be rsync which is a unix tool but can be used within applescript if you like.
I use on a daily basis to mirror and backup all our data from server to server.
It uses a special mechanism to compare directories for any differences.

Type ‘man rsync’ in the terminal, this will give you some idea what rsync is capable of.
I can help you putting it all together, but more info is needed…

–Peter–

A word of caution on rsync (and shell scripting in general). If you make a mistake, there is no forgiveness. :confused:

I was testing an rsync script and misplaced a single character. which lead to me deleting 3 years worth of research in about 30 seconds. And DELETED as in irrecoverable.

Not to scare you off since rsync is an amazing tool (and yes, I perservered and rolled one of the coolest utils I’ve ever written) - just be careful and use the -n or --dry-run options when testing.

Also, consider hiring a developer to build something for your needs. Many things can be done in Applescript for a fair price.

Cheers,
Jim Neumann
BLUEFROG

Why then not just use the Finder?

on run
	set itemsToMove to chooseItem()
	set destFolder to (choose folder with prompt "Choose a destination folder")
	
	repeat with i in itemsToMove
		tell application "Finder" to move i to destFolder
	end repeat
	
	display dialog "Moving Done" buttons {"Reveal Destination Folder", "Dismiss"} default button 2 cancel button 2
	-- if not dismissed
	tell application "Finder" to reveal destFolder
end run

on chooseItem()
	set myChoice to button returned of (display dialog "What kind of items do you want to move?" buttons {"Files", "Folders", "Both"} default button 3)
	-- files
	if myChoice is "Files" then
		set chosenItems to (choose file with prompt "Choose one or more FILES" with multiple selections allowed)
	end if
	
	-- folders
	if myChoice is "Folders" then
		set chosenItems to (choose folder with prompt "Choose one or more FOLDERS" with multiple selections allowed)
	end if
	
	-- both
	if myChoice is "Both" then
		set chosenItems to (choose file with prompt "Choose one or more FILES" with multiple selections allowed)
		set chosenFolders to (choose folder with prompt "Choose one or more FOLDERS" with multiple selections allowed)
		
		repeat with i in chosenFolders
			set end of chosenItems to (i as alias)
		end repeat
	end if
	
	return chosenItems
end chooseItem

Hope this helps you,
ief2

Sorry, got an error message from MacScripter and accidentally double posted :frowning:

ief2:

Using a Finder or System Events script is perfectly valid. I was merely responding to retepp’s suggestion about using rsync. Also, though much less intuitive than Applescript, shell scripting is often a more succinct (and often more powerful) method to use. It’s not for the faint-hearted but I do believe it’s a natural progression to higher-level languages.

Applescript >> shell scripting (BASH, perl, whatever) >> Obj-C is how I see it

Cheers!
Jim