Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to find a more solid and handy solution to my small problem.. My idea is to backup every midnight my home directory incrementally, so I want only the modified files (of today) to be copied to my external drive. I have prepared a script which does this:

find /home/user/* -mtime -1 -exec cp -r {} /media/Elements/BACKUP/ \;

It works but I noticed that it does not keep the full path name, and after the first day under /media/Elements/BACKUP I find all the latest files, as example:

If I modify /home/user/a/b/c.dat I'll find c.dat under /media/Elements/BACKUP/c.dat but I would like to have it of course under /media/Elements/BACKUP/a/b/c.dat Is there an simple flag to add to "find".. or some other trick?

share|improve this question

migrated from Dec 16 '12 at 17:41

This question came from our site for professional and enthusiast programmers.

up vote 0 down vote accepted

Maybe it would be easier to use a program like rsync instead of cp. rsync is designed to do that kind of stuff.

share|improve this answer
yes but once, unfortunately, it messed up a lots of things.. I wanted something basic I can control, like cp.. – Tiutto Dec 15 '12 at 21:22
actually after long time.. I tried again rsync and it works quite well! – Tiutto Dec 15 '12 at 21:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.