I am deleting approximately 4 million files from a partition and despite the size of all folders is around 350GB is taking a huge amount of time, over 4 hours now. Is there a way or a command to verify the status of the progression from CLI? I am on a W2K8 R2.
take a note of the free space available on the disk usage properties, take a note of the folder that has to be deleted, sum the free space to the disk size and refresh, then use proportions to calculate percentage.
There's a couple of things to consider here.
When you use the GUI, Windows doesn't erase files that are deleted, instead they're redirected to the Recycle Bin, where they will be purged based on age and space requirements. So nuking 4 million files will involve a lot of Recycle Bin housekeeping, which slows things down considerably (it also doesn't actually free up the space.) If you SHIFT-DEL the selected files, this will skip the Recycle Bin and speed things up.
Via the CLI, a wildcard delete of a folder/drive can take a while, but it IS a delete, and thus less file management hoops for the file system to jump thru. Unfortunately it doesn't give you progress, just a blinking cursor.
A scripted method would involve pulling a bare directory listing of all the files/folders you want cleaned (using the same wildcard as the first method), redirecting the DIR output to a file that is not located on the partition you intend to clean, and then walking thru that file with a FOR loop and deleting every entry in it singly. This would probably take as long to process as the GUI, but you could watch it as it progresses. Keep in mind that the empty folders left behind will have to be removed, as DEL doesn't touch folders, only files.
If you're cleaning out the entire partition, just go into Disk Management and kill the partition itself, then rebuild it and remap the same drive letter. The process of rebuilding will require a reformat, which will wipe all of the remnants away and give you a clean partition. You might have to recreate folders afterward, however, or any apps using the space will wonder where their storage locations went.