Ugly Hedgehog - Photography Forum
Home Active Topics Newest Pictures Search Login Register
Main Photography Discussion
Scripts for backing up.
Page 1 of 2 next>
Feb 11, 2020 15:10:27   #
SonyBug
 
Hello All,
Recently some posters were debating the merits of backup programs, and using DOS commands. It reminded me that I never found a program I liked for backing up. So, I went online to research xcopy, a DOS command run from the command prompt.

Here are the scripts that I put into a little batch file. Call it backup.bat

Xcopy C:\Users\dk_000\OneDrive\Pictures\*.jpg E:\pictures\*.* /c /d /f /j /s
Xcopy C:\Users\dk_000\OneDrive\documents\*.* E:\documents\*.* /c /d /f /j /s

Xcopy C:\Users\dk_000\OneDrive\downloads\*.* E:\downloads\*.* /c /d /f /j /s

I then created a CRON job to run every night. It performs the above backup.

The switches I use backup only changed files, keeping the directory structure. You can do lookups to see what all the switches do, and add any you want to change results. Good luck if you decide to go this route.

Dick K

Reply
Feb 11, 2020 15:31:48   #
Longshadow Loc: Audubon, PA, United States
 
SonyBug wrote:
Hello All,
Recently some posters were debating the merits of backup programs, and using DOS commands. It reminded me that I never found a program I liked for backing up. So, I went online to research xcopy, a DOS command run from the command prompt.

Here are the scripts that I put into a little batch file. Call it backup.bat

Xcopy C:\Users\dk_000\OneDrive\Pictures\*.jpg E:\pictures\*.* /c /d /f /j /s
Xcopy C:\Users\dk_000\OneDrive\documents\*.* E:\documents\*.* /c /d /f /j /s

Xcopy C:\Users\dk_000\OneDrive\downloads\*.* E:\downloads\*.* /c /d /f /j /s

I then created a CRON job to run every night. It performs the above backup.

The switches I use backup only changed files, keeping the directory structure. You can do lookups to see what all the switches do, and add any you want to change results. Good luck if you decide to go this route.

Dick K
Hello All, br Recently some posters were debating ... (show quote)



I built mine similarly, but made it ask me a backup set name (everything is under the backup set name) and where to back up to as sometimes when I plug the backup drive into the computer it is assigned a different drive designation. It also makes sure the "requested drive" is actually connected.
I don't have it run as a CRON job as we don't change things that often. I run it maybe once a month (or if I add a ton of images) at night.

Reply
Feb 11, 2020 16:10:20   #
Dngallagher Loc: Wilmington De.
 
SonyBug wrote:
Hello All,
Recently some posters were debating the merits of backup programs, and using DOS commands. It reminded me that I never found a program I liked for backing up. So, I went online to research xcopy, a DOS command run from the command prompt.

Here are the scripts that I put into a little batch file. Call it backup.bat

Xcopy C:\Users\dk_000\OneDrive\Pictures\*.jpg E:\pictures\*.* /c /d /f /j /s
Xcopy C:\Users\dk_000\OneDrive\documents\*.* E:\documents\*.* /c /d /f /j /s

Xcopy C:\Users\dk_000\OneDrive\downloads\*.* E:\downloads\*.* /c /d /f /j /s

I then created a CRON job to run every night. It performs the above backup.

The switches I use backup only changed files, keeping the directory structure. You can do lookups to see what all the switches do, and add any you want to change results. Good luck if you decide to go this route.

Dick K
Hello All, br Recently some posters were debating ... (show quote)


Very familiar with batch programming, but prefer to rely on commercial backup packages that work very well.

For me, Time Machine does a nice incremental every hour with no need to worry it will miss anything or take too long to run. Backups are automatic and using a 10 TB external means backups/versions for lots of months.

I also use Chronosync to backup just my images and some critical files on a monthly basis. The drive stays in a fire resistant/waterproof box and gets connected once a month. Nice thing is, Chronosync detects the connection of the drive and kicks off the backup right away. Only changes are backed up so the backup is complete within minutes.

Between Time Machine & Chronosync I end up with everything backed up locally, a protected disconnected copy of my images and critical files stored locally.

I also use Amazon Prime Photo’s to store copies of my images in the cloud in case I lose my originals and both locals.

Restores have been tested and are easily done from either local or from the cloud.

Chronosync was probably a $40.00 cost, Time Machine is free as part of OSX. Amazon Prime Photos is free for photo storage as a Prime member.

Reply
 
 
Feb 11, 2020 18:52:55   #
Longshadow Loc: Audubon, PA, United States
 
Everyone (who backs up) has their preferred method,
whatever works for them, as long as they do it.

Reply
Feb 12, 2020 06:16:26   #
Gene51 Loc: Yonkers, NY, now in LSD (LowerSlowerDelaware)
 
SonyBug wrote:
Hello All,
Recently some posters were debating the merits of backup programs, and using DOS commands. It reminded me that I never found a program I liked for backing up. So, I went online to research xcopy, a DOS command run from the command prompt.

Here are the scripts that I put into a little batch file. Call it backup.bat

Xcopy C:\Users\dk_000\OneDrive\Pictures\*.jpg E:\pictures\*.* /c /d /f /j /s
Xcopy C:\Users\dk_000\OneDrive\documents\*.* E:\documents\*.* /c /d /f /j /s

Xcopy C:\Users\dk_000\OneDrive\downloads\*.* E:\downloads\*.* /c /d /f /j /s

I then created a CRON job to run every night. It performs the above backup.

The switches I use backup only changed files, keeping the directory structure. You can do lookups to see what all the switches do, and add any you want to change results. Good luck if you decide to go this route.

Dick K
Hello All, br Recently some posters were debating ... (show quote)


Without reading/resetting the archive bit (/a and /m) aren't you backing up a huge number of duplicates?

I use SyncBack Free - which does anything and everything - mirroring (simple copy like your scripts), Syncing (looking at source and destination and ensuring that the contents of source and destination are the same), file versioning (allowing you to make backups of multiple versions of files without overwriting any), and much more. It also works via FTP, backs up to and manages cloud storage, etc. and has it's own scheduler. Not bad for a free application.

Reply
Feb 12, 2020 07:28:15   #
Longshadow Loc: Audubon, PA, United States
 
In my batch file I copy all desired files. The /D switch is a little ambiguous as to the change date if none is specified.

Each of my backups is a complete image of the originals selected. That way I don't have to go looking through multiple sets to find a particular file if it was not in the last incremental.
Incremental backups work better if one backs up often, like daily incrementals, with a full backup weekly.

Reply
Feb 12, 2020 08:40:21   #
Jack 13088 Loc: Central NY
 
Thanks for reminding me. I have been using xxcopy for so long I don’t remember exactly why. However, the guy that wrote it died a while back and it is no longer maintained. Still works but it is silly to count on that.

I like the script bc I backup to here, there and everywhere every time LR exits and I check to see that the removable disks are mounted and do a “Hey, stupid” if they are not. These are undoubtedly slower than multithreaded apps like Robocopy but I was unable to get it to do exactly what I wanted. I will look at Syncback Free to see if it will run from a script.

Reply
 
 
Feb 12, 2020 09:04:52   #
NCMtnMan Loc: N. Fork New River, Ashe Co., NC
 
Whatever backup routine or software you use, there is one very important thing to do on a regular basis. Try restoring a backup to a test location. Your backup is useless if you can't restore it.

Reply
Feb 12, 2020 09:34:33   #
Dngallagher Loc: Wilmington De.
 
NCMtnMan wrote:
Whatever backup routine or software you use, there is one very important thing to do on a regular basis. Try restoring a backup to a test location. Your backup is useless if you can't restore it.



Reply
Feb 12, 2020 10:27:17   #
BigDaddy Loc: Pittsburgh, PA
 
If you like rolling your own, you might want to look into Robocopy, which is a windows replacement for Xcopy, and is much more robust. Robocopy has been included free with windows for over 10 years. It is extremely flexible and with proper scripts can be made to do anything you can imagine in file backups. You can run batch scripts with a cron app, but windows has a built in task manager that substitutes for cron called Taskschd.msc. If you're really into writing scripts, you should look into REXX, which is a fantastic high level language for nerds and anyone with a proclivity towards programing.

Reply
Feb 12, 2020 13:48:36   #
KillroyII Loc: Middle Georgia
 
SonyBug wrote:
Hello All,
Recently some posters were debating the merits of backup programs, and using DOS commands. It reminded me that I never found a program I liked for backing up. So, I went online to research xcopy, a DOS command run from the command prompt.

Here are the scripts that I put into a little batch file. Call it backup.bat

Xcopy C:\Users\dk_000\OneDrive\Pictures\*.jpg E:\pictures\*.* /c /d /f /j /s
Xcopy C:\Users\dk_000\OneDrive\documents\*.* E:\documents\*.* /c /d /f /j /s

Xcopy C:\Users\dk_000\OneDrive\downloads\*.* E:\downloads\*.* /c /d /f /j /s

I then created a CRON job to run every night. It performs the above backup.

The switches I use backup only changed files, keeping the directory structure. You can do lookups to see what all the switches do, and add any you want to change results. Good luck if you decide to go this route.

Dick K
Hello All, br Recently some posters were debating ... (show quote)


I ran in to some limitations with xcopy and have been using Robocopy (free from Microsoft) for several years. One of the limitations, of xcopy, is not copying when the combination of multiple subdirectories is a longer string than it will handle.

Reply
 
 
Feb 12, 2020 13:49:46   #
KillroyII Loc: Middle Georgia
 
BigDaddy wrote:
If you like rolling your own, you might want to look into Robocopy, which is a windows replacement for Xcopy, and is much more robust. Robocopy has been included free with windows for over 10 years. It is extremely flexible and with proper scripts can be made to do anything you can imagine in file backups. You can run batch scripts with a cron app, but windows has a built in task manager that substitutes for cron called Taskschd.msc. If you're really into writing scripts, you should look into REXX, which is a fantastic high level language for nerds and anyone with a proclivity towards programing.
If you like rolling your own, you might want to lo... (show quote)


I have also been using Robocopy for several years. One of the limitations, of xcopy, is not copying when the combination of multiple subdirectories is a longer string than it will handle.

Reply
Feb 12, 2020 13:51:54   #
Longshadow Loc: Audubon, PA, United States
 
KillroyII wrote:
I ran in to some limitations with xcopy and have been using Robocopy (free from Microsoft) for several years. One of the limitations, of xcopy, is not copying when the combination of multiple subdirectories is a longer string than it will handle.

Luckily, I'm old school and use short directory names.

Reply
Feb 12, 2020 17:36:55   #
VTMatwood Loc: Displaced Vermonta in Central New Hampsha
 
I use xcopy as well and back up all my image and document files to two different sets of drives. In addition, i use a commercial backup application that images my disk to a third drive. I cap it all off with a cloud backup to Amazon drive. I have lost disks in the past that required commercial restoration... not happening again.

Reply
Feb 12, 2020 22:30:01   #
burkphoto Loc: High Point, NC
 
Dngallagher wrote:
Very familiar with batch programming, but prefer to rely on commercial backup packages that work very well.

For me, Time Machine does a nice incremental every hour with no need to worry it will miss anything or take too long to run. Backups are automatic and using a 10 TB external means backups/versions for lots of months.

I also use Chronosync to backup just my images and some critical files on a monthly basis. The drive stays in a fire resistant/waterproof box and gets connected once a month. Nice thing is, Chronosync detects the connection of the drive and kicks off the backup right away. Only changes are backed up so the backup is complete within minutes.

Between Time Machine & Chronosync I end up with everything backed up locally, a protected disconnected copy of my images and critical files stored locally.

I also use Amazon Prime Photo’s to store copies of my images in the cloud in case I lose my originals and both locals.

Restores have been tested and are easily done from either local or from the cloud.

Chronosync was probably a $40.00 cost, Time Machine is free as part of OSX. Amazon Prime Photos is free for photo storage as a Prime member.
Very familiar with batch programming, but prefer t... (show quote)




I gave up DOS and batch files in the mid-1990s. Too much brain clutter...

Reply
Page 1 of 2 next>
If you want to reply, then register here. Registration is free and your account is created instantly, so you can post right away.
Main Photography Discussion
UglyHedgehog.com - Forum
Copyright 2011-2024 Ugly Hedgehog, Inc.