Your best friend for file transfer.

Fetch application logoFetch

applescript and moving files (6 posts)

This is an archived topic. The information in it is likely to be out-of-date and no longer applicable to current versions of Fetch.
  • Started 10 years ago by reneo
  • Latest reply 8 years ago from Jim Matthews
  • reneo Member

    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 10 years ago #

  • 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 tell

    To 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 tell

    Thanks,

    Jim Matthews
    Fetch Softworks

    Posted 10 years ago #

  • reneo Member

    the first applescript to move everything was the right one and works fine!

    Many Thanks Jim!

    Posted 10 years ago #

  • 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

    Posted 8 years ago #

  • 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

    Posted 8 years ago #

  • 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

    Posted 8 years ago #

Topic closed

This topic has been closed.