Delete files using the Windows command line

In my D drive there is a shared folder like works ( D:\works ). I need to delete all files in this folder and subfolders except word and excel files . How can i do this?

0
source share
1 answer

You can do something similar to what this guy did: http://www.codesingh.com/2009/08/using-robocopy-to-delete-old-files-from.html

Something like this should work:

 mkdir D:\_tempDelete robocopy D:\works D:\_tempDelete /e /MOVE /XF *.xls* *.doc* rmdir D:\_tempDelete /s /q 

If you have permissions to create and delete folders on D :. Otherwise, you can simply transfer the files somewhere to your local drive and delete them there.

+1
source

Source: https://habr.com/ru/post/1440761/


All Articles