Jump to content

How to NOT duplicate when source is empty


Recommended Posts

I have setup a duplicate script for a server folder.

 

In order to have the exact same content, should I need to restore that server, I have my script setup to _replace_ the destination folder's content.

 

The problem is that I had a server crash that made it look my source folder was empty, so my script replaced a good duplicate of that server's past content, with nothing, which is logical, since the source is now empty (or at least look like so in the Finder)...

 

I wondering how I could write a selection rule or find any other way to more or less tell my script to stop if the source folder is empty and especially, to NOT replace my destination folder's content with a duplicate of nothing...

 

Thanks.

Link to comment
Share on other sites

Consider the case of a duplicate failing after copying only a few files. If you are set up to replace the contents, the first step is to delete all files, then start copying for the duplicate. There's really no solution as long as you keep doing duplicates rather than backups.

 

You need to make backups, rather than duplicates, so that history is preserved. And, even then, restoring needs to be done with care. Some may want an empty folder to be the restored state.

 

That said, it would seem to be possible to do what you ask if you wrote a shell script to do an "ls -l" of the source, pipe that result to "wc -l" to count the number of lines (and, thus, the number of files), and use that shell script and its result in a "trigger script" (looking at the name of your currently-executing Retrospect script) within the Retrospect Event Handler, to bypass the duplicate if necessary. Or, you could just have that shell script call rsync or some such (realizing that various versions of Apple's distributed rsync have bugs that don't preserve all metadata) to do the duplicate, rather than Retrospect.

 

Retrospect is not the best tool for the job when doing duplicates; Retrospect's strength is in doing backups (and restores from backups).

 

Russ

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...