So I have a NAS that I can only access via FTP which I have a rolling backup on.
I have 6 folders, one for each day of the week that backs up our shared folder/user folders and the 6th is a complete backup of our server. The issue I'm having is our backup software does not overwrite changed files, nor does it delete files off the backup drive that have been deleted on the source drive. As a solution l started completely deleting the previous weeks backup before the backup runs for that day.
I would like to automate this process by using a script however I can't just do a DELE "1 - Monday" because of the way permissions are setup(which can't be change, I already contacted the mfg and asked). The drive will not allow me to delete any folder that has files or other folders in it. For example:
For that I would have to delete file1.txt first then I would be able to delete Folder1. This is also true for even empty folders within folders, the empty folder has to be deleted first before the main folder can be erased.
So my question is how do I create a recursive script that will go in each folder delete everything within it then delete the folder.