I am in the process of setting up a shared network drive, that gets emptied periodically.
Its purpose is to provide an easy file sharing option for the users. Since I can't enforce them to always clean up after themselves, I want this drive to get emptied periodically.
I found and tried this using command prompt:
del /q "D:\Transfer$\*"
And then this:
del /q "D:\Transfer$\*"
for /D %p IN (D:\Transfer$\*) DO rmdir "%p" /s /q
But these don't delete the folders, only files.
How would the some code look, that deletes all contents (folders and files) of a given folder, without deleting the folder itself?