Keeping a second copy of files

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Keeping a second copy of files Fri Apr 18, 2008 12:34 pm • by blodwyn
Back in my Windows days, one of my favorite utilities was called Second Copy, which used to automatically maintain a copy of specified files/folders in a backup location, i.e. an external disk, Thumbdrive, whatever. So whenever you created or modified a file in a monitored location, it was automatically copied. To some extent Time Machine does that now for the Mac, although for the truly paranoid the one hour interval between TM copies is too long, or if like me you just want to keep a copy of your files on some portable media.

I use Spotlight Comments to tag and organize my files, and so I can keep all my files in one big folder imaginatively called "Tagged". It was therefore relatively easy for me to duplicate the Second Copy functionality using Hazel with one rule. If you have files in various folders it may take more than one rule for you to do the same.

I set up a "Tagged Second Copy" folder on a Thumbdrive, and copied all the files in my "Tagged" folder to it, so both folders were initially identical. Next I set up my Tagged folder to be monitored by Hazel and created one rule that monitors for file additions/changes in the last 5 minutes, and an action that copies them to my "Tagged Second Copy" folder on the Thumbdrive, replacing any previous version.

So now I just go about my business editing and creating files as normal, and almost immediately my Thumbdrive gets updated with the copy. A Growl notification lets me know whenever a file is copied over so I get instant gratification. I also used to have to remember to manually sync with my Thumbdrive at the end of the day, but now I don't need to do that.
blodwyn
 
Posts: 16
Joined: Thu Sep 07, 2006 4:25 pm

Re: Keeping a second copy of files Fri Apr 18, 2008 2:22 pm • by Mr_Noodle
Thanks for posting this. One thing you could tweak is instead of looking for "Date Modified is in the last 5 minutes", you could try "Date Modified is after Date Last Matched". Basically, this means if the file was changed since it last matched the rule. It might prove to be a tad more robust in the off-chance that Hazel gets tied up and doesn't get around to the file in 5 minutes.

Also, I feel obliged to warn people that this shouldn't be a replacement for a real backup system. If you are running Leopard, you should at least be using Time Machine. It's easy and painless and will save you a world of trouble if your drive goes bad.
Mr_Noodle
Site Admin
 
Posts: 8571
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Keeping a second copy of files Fri Apr 18, 2008 2:46 pm • by blodwyn
Mr_Noodle wrote:Thanks for posting this. One thing you could tweak is instead of looking for "Date Modified is in the last 5 minutes", you could try "Date Modified is after Date Last Matched". Basically, this means if the file was changed since it last matched the rule. It might prove to be a tad more robust in the off-chance that Hazel gets tied up and doesn't get around to the file in 5 minutes.

Also, I feel obliged to warn people that this shouldn't be a replacement for a real backup system. If you are running Leopard, you should at least be using Time Machine. It's easy and painless and will save you a world of trouble if your drive goes bad.


Both good points, thank you
blodwyn
 
Posts: 16
Joined: Thu Sep 07, 2006 4:25 pm

Re: Keeping a second copy of files Wed Apr 23, 2008 5:11 am • by manfredell
blodwyn wrote:
Mr_Noodle wrote:Thanks for posting this. One thing you could tweak is instead of looking for "Date Modified is in the last 5 minutes", you could try "Date Modified is after Date Last Matched". Basically, this means if the file was changed since it last matched the rule. It might prove to be a tad more robust in the off-chance that Hazel gets tied up and doesn't get around to the file in 5 minutes.

Also, I feel obliged to warn people that this shouldn't be a replacement for a real backup system. If you are running Leopard, you should at least be using Time Machine. It's easy and painless and will save you a world of trouble if your drive goes bad.


Both good points, thank you



Does this also match newly created files?

What when you delete a file, looks like it will be left in the backup this way.

(P.S. I also used SecondCopy in the "old" days and have been trying to duplicate this with Hazel. But the file deletion has been a problem so far....
manfredell
 
Posts: 7
Joined: Wed Jan 24, 2007 1:58 pm

Re: Keeping a second copy of files Wed Apr 23, 2008 12:15 pm • by blodwyn
manfredell wrote:
blodwyn wrote:
Mr_Noodle wrote:Thanks for posting this. One thing you could tweak is instead of looking for "Date Modified is in the last 5 minutes", you could try "Date Modified is after Date Last Matched". Basically, this means if the file was changed since it last matched the rule. It might prove to be a tad more robust in the off-chance that Hazel gets tied up and doesn't get around to the file in 5 minutes.

Also, I feel obliged to warn people that this shouldn't be a replacement for a real backup system. If you are running Leopard, you should at least be using Time Machine. It's easy and painless and will save you a world of trouble if your drive goes bad.


Both good points, thank you



Does this also match newly created files?

What when you delete a file, looks like it will be left in the backup this way.

(P.S. I also used SecondCopy in the "old" days and have been trying to duplicate this with Hazel. But the file deletion has been a problem so far....


Yes it does match new files - My rules are as follows:

If any of the following conditions are met
Date Added > is in the last > 1 hour
Date Last Modified > is after > Date Last Matched
Copy file to folder > Second Copy Folder

You are right in that it doesn't sync any file deletions. Every couple of weeks I use Chronosync to sync to an encrypted image that I store on Amazon S3. I've set Chronosync to sync file deletions with this image so as a workaround I think I'll just add a sync action to sync any deletions with my Second Copy Folder too. If you find a slicker way then please share!
blodwyn
 
Posts: 16
Joined: Thu Sep 07, 2006 4:25 pm

Re: Keeping a second copy of files Wed Apr 23, 2008 2:36 pm • by manfredell
blodwyn wrote:You are right in that it doesn't sync any file deletions. Every couple of weeks I use Chronosync to sync to an encrypted image that I store on Amazon S3. I've set Chronosync to sync file deletions with this image so as a workaround I think I'll just add a sync action to sync any deletions with my Second Copy Folder too. If you find a slicker way then please share!


Some time ago I asked Mr. noodle about this. He wanted to look into this for a future release. Hope he can implement this.
manfredell
 
Posts: 7
Joined: Wed Jan 24, 2007 1:58 pm

Re: Keeping a second copy of files Thu Apr 24, 2008 8:32 pm • by Mr_Noodle
I did say I would look into it but I can't say if/when it will get done. The problem is that when you delete a file, there is no file to run the actions on. What would the actions actually mean in this case? You can't move a non-existent file. You can't color it or set it's comment. As you can see, it doesn't quite work into the current paradigm very well.

To do full syncing you may be better off with a specialized program. Another option is to cook up a script that uses rsync. You can then watch a folder and everytime it changes, you run rsync on the whole folder.
Mr_Noodle
Site Admin
 
Posts: 8571
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

Re: Keeping a second copy of files Fri Apr 25, 2008 4:22 am • by manfredell
Mr_Noodle wrote:I did say I would look into it but I can't say if/when it will get done. The problem is that when you delete a file, there is no file to run the actions on. What would the actions actually mean in this case? You can't move a non-existent file. You can't color it or set it's comment. As you can see, it doesn't quite work into the current paradigm very well.


Looking at it this way you may be right... :-(
manfredell
 
Posts: 7
Joined: Wed Jan 24, 2007 1:58 pm

Re: Keeping a second copy of files Fri May 30, 2008 11:49 pm • by humblec
Wold the work around for deleting files be letting Hazel delete them.

You would label files you wanted deleted red-as an example. Then have a rule to move any red labeled files to the backup folder-replacing existing files. Then also another rule that will move to trash any red labeled files added > 2 days/hours ago in the backup folder- or less if you want. This would give you a backup of your deleted files temporarily in addition to the latest version of your files.
humblec
 
Posts: 1
Joined: Fri May 30, 2008 11:34 pm

Re: Keeping a second copy of files Sat May 31, 2008 11:10 am • by Mr_Noodle
Quite clever. Haven't tested it myself but it looks like it might work. Just to be clear, you'd need to monitor both the source and backup folders. In any case, thanks for coming up with this.
Mr_Noodle
Site Admin
 
Posts: 8571
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Tips & Tricks - DO NOT POST QUESTIONS

cron