Creating a .bash file for backup

Joined
Jan 20, 2019
Messages
2
Reaction score
0
Points
1
Location
Denmark
I need some help writing a .bash file for Mac that backs up photos on a extern HDD. I have some criterias:

  • I should only need to run one single file and then it does all the backup work for me
  • I want it to run in the background
  • It shall search for all photos (.jpeg types are fine unless Mac uses different file types as well) and back them up in their original folder structure
  • It should only search for places you would usually place your photos in a Mac (like a photo folder, the desktop folder, different drives etc.)
  • If a single file or more fails to backup it shouldn't give me a notice and just keep on going (again I want it to run silently in the background)
  • It should back it all up on the extern HDD I've attached to the Mac under a folder called "PhotoBackup"
  • It should copy hidden files as well
  • Each time I run it it shall only add photos added since last time it was run


So basicly it's just a backup code that makes sure that all photos I have on my laptop is copied onto my HDD with the same folder structure. I've made this for PC, but I haven't got the skills to do it with Mac. Here's my .bat code (notice I have a script making it run as a hidden process):

@echo off
title Checking file integrities...
:: variables
SET odrive=%odrive:~0,2%
set backupcmd=xcopy /s /c /d /h /i /r /y /exclude:%drive%\excludelist.txt
echo off
%backupcmd% "%USERPROFILE%\*.jpg" "%drive%\backup"
%backupcmd% "D:\*.jpg" "%drive%\backup\drive D"
%backupcmd% "E:\*.jpg" "%drive%\backup\drive E"
@echo off
cls


If someone can make this work I would be thrilled. I'm even willing to pay for your trouble...
 
OP
R
Joined
Jan 20, 2019
Messages
2
Reaction score
0
Points
1
Location
Denmark
Well nevermind. I found a program which back everything up just as easily.
 

Shop Amazon


Shop for your Apple, Mac, iPhone and other computer products on Amazon.
We are a participant in the Amazon Services LLC Associates Program, an affiliate program designed to provide a means for us to earn fees by linking to Amazon and affiliated sites.
Top