Noob question. Moving and deleting files.

OK… I’m trying to move files from an AFP volume to another AFP volume. Problem is, the move command isn’t moving the file, it’s copying it.

Here’s my script… the copying part works… the deleting part doesn’t.

on adding folder items to thisFolder after receiving theAddedItems
	
	delay 5
	
	tell application "Finder"
		
		move theAddedItems to folder "Macintosh HD:Users:bob:Desktop:Test"
		
		delay 30
		
	end tell
	
end adding folder items to

tell application "Finder"
	
	delete theAddedItems of folder thisFolder
	
end tell

Any help would be greatly appreciated!
Thanks! :smiley:

Browser: Firefox 1.5.0.2
Operating System: Mac OS X (10.4)

Hi, Guriboy.

Parameter variables in a handler are “local” to that handler and can’t be seen outside it. In this case, you’re trying to delete ‘theAddedItems’ outside the ‘adding items to’ handler. Also, the value of ‘theAddedItems’ is a list of aliases that are complete in their own right, so you don’t need (ie. mustn’t use) ‘of folder thisFolder’.

on adding folder items to thisFolder after receiving theAddedItems
  
	delay 5
  
	tell application "Finder"
    
		move theAddedItems to folder "Macintosh HD:Users:bob:Desktop:Test"
    
		delay 30
    
		delete theAddedItems
  
	end tell
  
end adding folder items to

You beat me to it, Mr G. :wink:

Incidentally, unless the delays are in there for some other reason, I don’t need 'em here - since Finder waits for the move to complete before deleting:

on adding folder items to after receiving theAddedItems
	tell application "Finder"
		move theAddedItems to folder "Macintosh HD:Users:bob:Desktop:Test"
		delete theAddedItems
	end tell
end adding folder items to

Thanks guys! Very much appreciated!