使用Windows命令提示符删除文件 [英] Delete Files with Windows Command Prompt

查看:227
本文介绍了使用Windows命令提示符删除文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

D 驱动器中有一个共享文件夹工作 D:\\ \\works )。我需要删除该文件夹中的所有文件和子文件夹除了word和excel文件在那里。我可以这样做?

There is a shared folder in my D drive as works (D:\works). I need to delete all the files in that folder and sub folders except word and excel files in there. how can i do this ?

推荐答案

你可以做类似于这个家伙做的事情: http://www.codesingh.com/2009/08/using-robocopy -to-delete-old-files-from.html

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

这样应该可以工作:

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

如果您有权限在D上创建和删除文件夹:。否则,您只需将文件移动到本地驱动器上的某个位置,然后从那里删除它们。

Provided you have permissions to create and delete folders on D:. Otherwise you could just move the files somewhere on your local drive and delete them from there.

这篇关于使用Windows命令提示符删除文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆