Monday 12 April 2010

Deleting old Lightroom backups

Lightroom is a nicely thought out application and one of it's nice thoughts is that it reminds you to backup your Lightroom database on a regular basis. This is a good thing, you should listen to it's advice and make sure you take those backups regularly.

If you always cancel out of the backup dialogue, or worst still have disabled it ,just delete your Lightroom catalogue now.  This will save all the hassle of waiting till something goes wrong with your hardware/software/mind. Always, always make sure you have a backup.

The only problem with the Lightroom backup system is that it can start to fill up your hard disk with lots of old copies of your catalogues. It would be nice if there was away to automatically limit it to only keeping 2 months or so worth of backups.  Well after a quick bit of fettling I worked out a way to do this.

The instructions below are for windows PCs, if you've got a Mac there is probably some animated icon of Steve jobs you can click on and all your problems will be solved.

1.First identify what directories you are backing up to.  These are usually in a folder called Backups inside the directory where your caltalouge lives In my case they are:
D:\Catalogs\Lightroom\Backups
and
D:\Catalogs\Lightroom\Archive\Backups

2. Open Notepad:
  • In XP choose Start>Run and type notepad click OK.
  • in Vista/Windows 7 just type notepad in the search box & click on the notepad icon

3. Paste in the following code:

forfiles /p "D:\Catalogs\Lightroom\Backups" /c "cmd /c rd @file /s /q" /d -60


replace D:\Catalogs\Lightroom\Backups with path to your backups you found in step 1
Repeat for each of the folders you found in step 1.
My final file looks like this:

forfiles /p "D:\Catalogs\Lightroom\Backups" /c "cmd /c rd @file /s /q" /d -60
forfiles /p "D:\Catalogs\Lightroom\Archive\Backups" /c "cmd /c rd @file /s /q" /d -60


Note: the -60 at the end means "delet backups older than 60 days" you can edit this to any number of days you like.

3. Save the file as DeleteLRBackups.bat (the .bat bit is very important) in a c:\batch folder (if you don't have one create it).

4. Now all you need to do is schedule this as a task to run whenever you like.

10 comments:

Unknown said...

forfiles is an optional component and isn't present on my XP system. Where did you get it from?

Chris Shepherd said...

Hi Matt,

Sorry it was on an XP machine I looked at so I figured it was ion all of them.

You can download it from here (direct link to zip file)

Mike Nelson Pedde said...

Chris: Thanks for this. I ran it for the first time today and it freed up some 30GB of hard drive space. I've cross-posted your article on my blog, here:
http://www.wolfnowl.com/2010/05/deleting-old-lightroom-backups/

Mike.

P.S. I've also added you to my 'Lightroom Links' page, here:
http://www.wolfnowl.com/2010/01/photography-links-adobe-photoshop-lightroom/

Chris Shepherd said...

Thanks for the link Mike - glad you found it to be of service.

lkugle said...

Thanks a lot. I just read this and gave it a try. Works great.

lkugle said...

Is there a way delete old files based on the number of files rather than how old they are?

lkugle said...

Is there way to delete old files based on the number of files, rather than how old they are?

Chris Shepherd said...

I can't think of an easy way to do it by number of backups I'm afraid.

Chris

David Portwain said...

Does that work on LR CC too, with W7 and W10?

Chris Shepherd said...

Yes it does