scripts in OSX

Discussion in 'OS X Yosemite (10.10)' started by ssar17, Feb 1, 2015.

  1. ssar17 macrumors newbie

    Joined:
    Feb 1, 2015
    Location:
    VA
    #1
    I have a USB stick that I want to copy all files and folders from the USB stick to my OneDrive account to get the newest files out there.

    I want to copy all folders and files that are newer (updated most recently)

    from

    Volumes/BAUERBKUP/Documents/College/Capella

    to

    /Users/dbauer/Desktop/OneDrive/Documents/Capella

    I also want to do the reverse and backup all files from the OneDrive account to my USB stick and assume the commands are the same just switching the locations.

    How do I do this on a Mac OS X? I do scripts in Windows but never on a Mac and have no clue where to even start.

    If this is not the right place for this question, tell me where to post this and I will.
     
  2. leman macrumors 604

    Joined:
    Oct 14, 2008
  3. ssar17 thread starter macrumors newbie

    Joined:
    Feb 1, 2015
    Location:
    VA
    #3
    i looked up rsync and tired

    rsync -vruntW /Volumes/BAUERBKUP/Documents/College/Capella /Users/dbauer/Desktop/OneDrive/Documents/Capella

    I used the n to test the script and it seems like way too many files. Is this the right syntax?
     
  4. w0lf, Feb 1, 2015
    Last edited: Feb 18, 2015

    w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
    #4
    I believe you need an extra / at the end of the first folder

    rsync -vruntW /Volumes/BAUERBKUP/Documents/College/Capella/ "$HOME"/Desktop/OneDrive/Documents/Capella
     
  5. ssar17 thread starter macrumors newbie

    Joined:
    Feb 1, 2015
    Location:
    VA
    #5
    Should I be using -a instead of -r? I am trying to copy only they newest files and not sure which option to use?
     
  6. ssar17 thread starter macrumors newbie

    Joined:
    Feb 1, 2015
    Location:
    VA
    #6
    I am now using
    rsync -avtuW /Volumes/BAUERBKUP/Documents/College/Capella/ /Users/dbauer/Desktop/OneDrive/Documents/Capella

    it seems to copy updated files into the OneDrive/Documents/Capella properly but it also is creating another folder called Capella under Capella with everything. I do not want that. I am just trying to copy newer files from the USB stick into the OneDrive account. I added the u for only updated files and the W for whole files. I am not sure the t is needed with the a or not.

    Any help would be appreciated.

    BAUERBKUP is my USB stick:confused:
     
  7. w0lf macrumors 65816

    w0lf

    Joined:
    Feb 16, 2013
    Location:
    USA
    #7
    Well once again I'm not 100% sure on this but if you're getting the folder showing up inside the folder you want you need to remove one level off the destination path. I guess that the proper command would then be:

    rsync -avtuW /Volumes/BAUERBKUP/Documents/College/Capella/ "$HOME"/Desktop/OneDrive/Documents/

    Honestly it's probably best to just test the command with a tiny little test folder before doing anything.

    Also running the command first with

    -n (perform a trial run with no changes made)
    -i (output a change-summary for all updates)
    -v (verbose -- print more info while running)
     
  8. ssar17, Feb 18, 2015
    Last edited: Feb 18, 2015

    ssar17 thread starter macrumors newbie

    Joined:
    Feb 1, 2015
    Location:
    VA
    #8
    rsync -avtuW /Volumes/BAUERBKUP/Documents/College/Capella/ "$HOME"/Desktop/OneDrive/Documents/Capella

    This works. I went to my USB stick and there was a second folder Capella under Capella. Want a dummy I am! I am not sure how that got on my USB stick.

    The above command works now just fine. Thanks to all who helped. I knew the syntax had to be correct for all that I read.
     

Share This Page