Sunday, September 22, 2019

Solved! Deleting large files and folders from mapped network drive in File Explorer is very slow

Print Friendly and PDF

The two commands that users require are Del, for deleting files, and Rmdir, for removing directories.
  1. Tap on the Windows-key, type cmd.exe and select the result to load the command prompt.
  2. Navigate to the folder that you want to delete (with all its files and subfolders). Use cd path, e.g. cd o:\backups\test\ to do so.
  3. The command DEL /F/Q/S *.* > NUL deletes all files in that folder structure, and omits the output which improves the process further.
  4. Use cd.. to navigate to the parent folder afterwards.
  5. Run the command RMDIR /Q/S foldername to delete the folder and all of its subfolders.
The commands may require some explanation.
DEL /F/Q/S *.* > NUL
  • /F -- forces the deletion of read-only files.
  • /Q -- enables quiet mode. You are not ask if it is ok to delete files (if you don't use this, you are asked for any file in the folder).
  • /S -- runs the command on all files in any folder under the selected structure.
  • *.* -- delete all files.
  • > NUL -- disables console output. This improves the process further, shaving off about one quarter of the processing time off of the console command.
RMDIR /Q/S foldername
  • /Q -- Quiet mode, won't prompt for confirmation to delete folders.
  • /S -- Run the operation on all folders of the selected path.
  • foldername -- The absolute path or relative folder name, e.g. o:/backup/test1 or test1

I belong to a private, fee-based group of Pythonistas.

If you would like to know more about PythonistaCafe, where we share thoughts, ideas, fixes, and a sense of courteous community, look to Dan Bader, who started it all. He also offers free tips by email. Oh, and if you take an interest in good marketing writing, read his stuff for that reason too. 

No comments:

Post a Comment

Positive comments, corrections and clarification welcome.