scripts in OSX

ssar17

macrumors newbie
Original poster
Feb 1, 2015
5
0
VA
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.
 

ssar17

macrumors newbie
Original poster
Feb 1, 2015
5
0
VA
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?
 

w0lf

macrumors 65816
Feb 16, 2013
1,233
73
USA
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?
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
 
Last edited:

ssar17

macrumors newbie
Original poster
Feb 1, 2015
5
0
VA
Should I be using -a instead of -r? I am trying to copy only they newest files and not sure which option to use?
 

ssar17

macrumors newbie
Original poster
Feb 1, 2015
5
0
VA
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:
 

w0lf

macrumors 65816
Feb 16, 2013
1,233
73
USA
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)
 

ssar17

macrumors newbie
Original poster
Feb 1, 2015
5
0
VA
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.
 
Last edited: