Ubuntu 16.04
I would like to backup all .txt, .cfg, and .ini files, while keeping their folder structure to a zip file in the backups folder.
I know there is an easier way to do this entire operation but this is what I have.
#!/bin/bash
wdir="/home/files"
backup_dir="/home/files/backup"
allcfg=$(find suan -name '*.cfg')
alltxt=$(find suan -name '*.txt')
allini=$(find suan -name '*.ini')
timeStamp="$(date +%Y--%b-%d--%k:%M--%P)"
backupfilename="${backup_dir}/Backup-${timeStamp}.zip"
#-- set some arrays ...
backupfiles=( "$allcfg" "$alltxt" "$allini" )
cd "$wdir"
zip -r "$backupfilename" "$backupfiles"
So I can see a nice output of the files it files but when it gets to the zipping part it errors out.
zip error: Nothing to do! (try: zip -r /home/files/backup/Backup-2018--Jul-04--21:37--pm.zip . -i suan/cfg/360controller.cfg
But that doesn't work either.
find