Server Fault is a question and answer site for system and network administrators. 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 need to recover files that have been deleted.

My scenario:

I have a rsync script that runs at 9PM and mirrors everything from server1 directory to another directory on backup server2.

A couple of files have been accidentally deleted from server1.

How do I recover those files from server1 with rsync?

share|improve this question
up vote 2 down vote accepted

You should be able to do so with the --update option. According to the man page

This forces rsync to skip any files which exist on the destination and have a modified time that is newer than the source file. (If an existing destination file has a modification time equal to the source file's, it will be updated if the sizes are different.)

share|improve this answer

From server1:

scp root@server2:/backupdir/myfile /mydirectory/myfile
share|improve this answer
Not really what I'm looking for. I'm trying to recover only the deleted files, not the entire directory. – hfranco Apr 21 '10 at 20:16
Ah okay. I assumed you had a list of specific files that were deleted. – Jake Wilson Apr 22 '10 at 17:20

Your Answer


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

Not the answer you're looking for? Browse other questions tagged or ask your own question.