57
16
I want to remove all files from a folder structure, so I'm left with an empty folder structure.
Can this be achieved in either batch or VBScript scripting?
I have tried a very basic batch command, but this required the user to allow the deletion of each file. This wasn't a suitable solution as there are many hundreds of files and this will increase massively over time.
What can you suggest?
I'll second @BigHomie's recommendation - I just learned some PowerShell and I'd have to say it's pretty neat - not too hard, a good weapon in any coder's arsenal. I use it fairly frequently now. – Ben – 2014-12-19T17:13:44.800
If you want to delete recursively based on the extension:
ls -Recurse *.docx | rm
. – Kolob Canyon – 2016-10-12T20:34:58.910You mean a recurssive delete? This can indeed be done. Something like
rd /s /q "c:\folder a
will perform a recursive delete on all files and folders withinFolder A
– Ramhound – 2014-04-15T12:47:43.990I could do, I dont know how to script in powershell but have previous run powershell scripts. – BobJim – 2014-04-15T13:41:42.227
2Now is a perfect time to learn, I would research batch and vbs syntax for legacy purposes, but invest more time in learning PS. – MDMoore313 – 2014-04-15T14:26:27.560
I havent had the chance to check the code yet although I'm sure it will work. I will come back and select the most appropiate answer to my initial query. – BobJim – 2014-04-17T07:08:06.123