Copy all files from External HDD

Discussion in 'Mac Programming' started by KeanYau, Aug 29, 2014.

  1. KeanYau macrumors newbie

    Joined:
    Aug 29, 2014
    #1
    Hi,

    I am new to Apple Script and would like to make a script to copy all files from external HDD to a folder in Desktop. It works from a folder to another folder in local HDD but was not successful when I want to copy the file from external HDD. The script was written as below but error with "files in external HDD location was not found." New Volume is the name of my external HDD. Can anyone advise? :confused:

    tell application "Finder"
    set source_folder to "/Volumes/New Volume"
    set target_folder to folder "Test" of desktop
    set the_files to every file of source_folder
    repeat with each_file in the_files
    set file_name to name of each_file
    if not (exists file file_name of target_file) then
    duplicate each_file to target_folder
    end if
    end repeat
    end tell
     
  2. ArtOfWarfare macrumors G3

    ArtOfWarfare

    Joined:
    Nov 26, 2007
    #2
    Much easier with bash, isn't it?

    Code:
    mv /path/to/source/* /path/to/destination
    I might have the source and destination backwards - check the man page for mv.
     
  3. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #3
  4. KeanYau thread starter macrumors newbie

    Joined:
    Aug 29, 2014

Share This Page