Your best friend for file transfer.

applescript and moving files (6 posts)
- Started 19 years ago by reneo
- Latest reply 17 years ago from Jim Matthews
-
reneo Member
-
Jim Matthews Administrator
Do you want to move the files (so they will be at the destination, and not at the source) or copy the files (so they will be in both places)?
To move you want something like this:
set vPlaatjesFolderFTP to "ftp://x:y@z/www/kijkje/test"
tell application "Fetch 4.0.3"
open url vPlaatjesFolderFTP
set itemCount to count remote item of transfer window 1
repeat itemCount times
set itemName to name of remote item 1
set name of remote item 1 to "../testarchief/" & itemName
end repeat
end tellTo duplicate the files you want something like this:
set vPlaatjesFolderFTP to "ftp://x:y@z/www/kijkje/test"
set vPlaatjesArchiefFolderFTP to "ftp://x:y@z/www/kijkje/testarchief"tell application "Fetch 4.0.3"
open url vPlaatjesFolderFTP
set itemList to name of every remote item
duplicate remote item itemList to url vPlaatjesArchiefFolderFTP
end tellThanks,
Jim Matthews
Fetch Softworks -
reneo Member
the first applescript to move everything was the right one and works fine!
Many Thanks Jim!
-
curtisdw Member
Maybe you can help me - I rewrote the script to reflect settings I would use ...
------------------------------------
set mySourceFTP to "ftp://user:pass/servername.com/default_directory/next_directory"tell application "Fetch 4.0.3"
open url mySourceFTP
set itemCount to count remote item of transfer window 1
repeat itemCount times
set itemName to name of remote item 1
set name of remote item 1 to "../destination_directory/" & itemName
end repeat
end tell
-----------------------QUESTIONS:
1. Did I do this right?
2. Once finished, how would I use it?
3. Does the line:
"set name of remote item 1 to "../destination_directory/" & itemName"rename the files in the source directory - or does the script move the files to the destination directory keeping the original filenames?
---------------------
Any help is most appreciated,
Curtis
-
curtisdw Member
Maybe you can help me - I rewrote the script to reflect settings I would use ...
------------------------------------
set mySourceFTP to "ftp://user:pass/servername.com/default_directory/next_directory"tell application "Fetch 4.0.3"
open url mySourceFTP
set itemCount to count remote item of transfer window 1
repeat itemCount times
set itemName to name of remote item 1
set name of remote item 1 to "../destination_directory/" & itemName
end repeat
end tell
-----------------------QUESTIONS:
1. Did I do this right?
2. Once finished, how would I use it?
3. Does the line:
"set name of remote item 1 to "../destination_directory/" & itemName"rename the files in the source directory - or does the script move the files to the destination directory keeping the original filenames?
---------------------
Any help is most appreciated,
Curtis
-
Jim Matthews Administrator
That looks correct. The script would move files to the other directory, but the files would keep their original names.
Thanks,
Jim Matthews
Fetch Softworks
- Page 1
Topic closed
This topic has been closed.
I'm trying to put an applescript together that moves all files in a folder to an other directory under the same root, but can't get it to work... this is the code that keeps giving me errors:
set vPlaatjesFolderFTP to "ftp://x:y@z/www/kijkje/test"
set vPlaatjesArchiefFolderFTP to "ftp://x:y@z/www/kijkje/testarchief"
tell application "Fetch 4.0.3"
run
set vMove to every file of url vPlaatjesFolderFTP
move vMove of url vPlaatjesFolderFTP to vPlaatjesArchiefFolderFTP
display dialog "ready"
end tell
anyone with The Solution?!?
Posted 19 years ago #