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:

Folder1
        >file1.txt

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.
HeinikenManAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewIT / Software Engineering ConsultantCommented:
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.

http://webscripts.softpedia.com/script/Internet-Browsers-C-C/FTP/LFTP-28455.html

~bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
HeinikenManAuthor Commented:
Thanks for the help
0
Bill PrewIT / Software Engineering ConsultantCommented:
Welcome, thank you.

~bp
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Powershell

From novice to tech pro — start learning today.