I want to backup a folder and it’s contents by placing a copy of the folder and it’s contents into a folder in the same directory as the folder being backed up. As the folder is re-created in the backup directory I want to append the next number to the folder name.
For example:
MainDirectory Contents: FolderImportant FolderBackup FolderOthers
FolderImportant will never be a different name. FolderImportant and it’s contents need to be copied into FolderBackup and have the number 001 appended to the folder name (on the first backup), the contents to remain unchanged.
I have looked through the forum and found several examples of backup, and of renaming, but with the little I know about bash I am not sure how to put everything into an all-in-one script.
After a crash course in bash, I have a functional script. Please comment if there is something that can be done to improve this script as I am less than 6 hours into learning bash scripting.