Hi All,
I'm wondering if anyone could offer some advice on a script that would help me do the following:
I have a directory on a windows server 2012 r2 server named staging. Staging contains folders 1-1000 and each of these folders contain subfolders 1-1000 (1,000,000 folders in total). A lot of these subfolders contain around 100 0-2kb files.
We copied this directory a bit ago to a new SSD volume as it wasn't doing what it was supposed to very quickly.
We now want to clear up the original staging folder, but each of the 1000 top level folders take about half an hour each and the system starts performing quite slow while this is happening.
My question is, is there a script or batch file I can run which will delete the first top level folder, then say an hour later when the scheduled task runs again delete the next folder and so on?
So I want something that will look in staging and take folder 1, delete it and it's contents. Then when it next runs it will take folder 2 and do the same. Folder 3, folder 4 etc.
I thought something like:
cd c:\staging
set folder=%variable that looks for the first folder%
rmdir /s /q %folder%
Hope someone can help