Delete files over ftp in script

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.
Who is Participating?
Bill PrewCommented:
I don't think you are going to find a practical way to do this with the baseline built-in Windows FTP client.

Take a look at LFTP though, it has a built-in recursive folder delete command as I recall.

HeinikenManAuthor Commented:
Thanks for the help
Bill PrewCommented:
Welcome, thank you.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.