Skip to main content

Just learned about rsync

I just learned about the rsync command which is amazingly useful.
I have been using scp to copy folders from one machine at home to a machine in the lab back and forth and so far it's been good, and dead simple, but always involved extra work like making
moving directories around.

Now that I learned rsync, I can simply back up my work from the lab to my machine and vice versa using a simple command.
Here is the command I use:

rsync --delete -ravuzn -delete-excluded --exclude=*~ --rsh=ssh ~/work/

and then, (notice I remove the n flag)

rsync --delete -ravuz -delete-excluded --exclude=*~ --rsh=ssh ~/work/

so what does this command do:
--delete: if I have removed files from my local computer, they are also deleted on the server
r: recursively go through the folders and subfolders
a: archive
v: verbose mode
u: update
z: compress files
--delete-excluded: deletes excluded files passed as parameter (next flag)
--exclude=*~ : tells to exclude files ending with tilda (~)

there is also -b, which is for backup. It will create a file with ~, whenever we delete a file on the machine to which we are syncing. That might be useful if you don't want to delete some important work.
Also, there is flag n, which runs the rsync command as a dry run. This way, you can see what will happen when you run the same command without the n flag. This is the one I will always use first so that I am sure I know what will happen!

Thanks to this website:


Popular posts from this blog

HTML5 Dev Conf and IOTAConf

Next week is going to be really fun. I have the opportunity to attend the HTML5DevConf and IOTAConf again and also go to a new conference hosted by Twitter: Twitter Flight Here's the schedule of the talks I intend to go for the HTML5DevConf: Monday: 7:30-9:00 Registration 9:00-9:50 1. The Web of things - Leveraging the web for the internet of things, E-135 2. Design patterns for an internet of things, N-123 3. Dump SASS and Less CSS for JS powered CSS, Michael Mikowski, Qualaroo, E-131 10-10:40 Break 10-40-11:30 1. How to create native-like experience in the mobile web, E-131 2. Bringing Web content to the big screen with google cast, E-130 11:40-12:30 1. Virtual Reality & the future of the web, E-135 2. The new meteor platform, web and native mobile from a single reactive javascript codebase, E-133 1:30-2:20 1. Engaging Apps: Service Workers, Push an

Run python inside python and capture output

This is taken from How to execute python inside python and capture output: A quick solution using popen : import os result=os.popen('command').read() print result where command is your command (expl. on windows: dir,ipconfig,...) If you expect more than a line and want each word in a list: import os,string result=string.split(os.popen('dir/w').read())