删除是删除整个目录而不是单个文件

时间:2008-12-16 14:57:52

标签: batch-file cmd

我正在运行一个简单的批处理文件,该文件由vbscript生成以删除单个文件,但是当我执行它时,它正在删除整个子目录。任何人对此都有任何想法?以下是批处理文件。

rem 2008-12-15D:\DP-Production\Administrative\BUSINESS\FileLink
del D:\DP-Production\Administrative\BUSINESS\FileLink\.-1003067260  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\.-997208891  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\.-998224323  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._proofing.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Sample1.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Shortcut (2) to PDFProofs.lnk  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Shortcut to Art.lnk  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Shortcut to Filelink on 'Admin-srv' (I).lnk  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Shortcut to LeadGen program.lnk  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Shortcut to Mail.lnk  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Shortcut to Maintained on 'Data Pro (Pmi41)' (H).lnk  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Shortcut to Openjobs on 'SRV-srv02' (J).lnk  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._SHRP.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._skyphone2.bmp  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Smokey Bones Solo_Mailer.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._steakhouseback.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._steakhousefront.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Summercamp.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._taxsampleback.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._taxsamplefront.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Temporary Items  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Beta.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Trurdy.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Trash  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._trishwenrick.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._Tulane.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._valpak_price.mdb  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\._WasteM.jpg  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\weekly_deletions.vbs  /q/f
rem 2008-12-15D:\DP-Production\Administrative\BUSINESS\FileLink\Art
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\._+.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\._0805_NJGolf 12-44-24.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\._806857.eps  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\._ADPLogo.JPG  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\._FranchiseLtr_MM.doc  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\._REPAIR-SMA.doc  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\._Safety.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\._Summer 2008 Donor V1.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Art\desktop.ini  /q/f
rem 2008-12-15D:\DP-Production\Administrative\BUSINESS\FileLink\Mail
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\ BOBBSS    LIST COUNT - DRIBOX 2008-06 ejs.msg  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\#7608 GHA MD Mailing.ZIP  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\2008 Adel List.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\2008 mailing-BREAK OUT.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\2008 Password Letter to GM (R).doc  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\2008 RL Mailing.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\2008DLRCRICKPage1.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\805026.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\805442_Breakfast.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\806330_Letter.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\806778.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\806785 JONES WORLD VIEW DHL.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\807364-807117.csv  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8522435_INTDELIVERY.zip  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8674252_INTDELIVERY.zip  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8674856_INTDELIVERY.zip  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8675351_INTDELIVERY.zip  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8694521_INTDELIVERY.zip  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8720608_INTDELIVERY.zip  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8cletoy0903_1.csv  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8roncar0657.csv  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\8vanhyu0531.zip  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\addressfile0605.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\All Active Employee Address 070808.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\APPA_Mailing_List-FINAL-XLS4.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\Aug 08 Coupon Data.txt  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\BMA.pdf  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\BODYCOPY.doc  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\BOISE JUNE SALON MASTER LIST rev 6-9-08 (6).xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\Broward Committe REVISED.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\CAW Tournament Letter (2).doc  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\detroit lasalle delete list.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\CHIROPRACTOR 300.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\CMTFV08204macroed.bak  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\Comm Ltr#2.doc  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\Contact Directory.rtf-MA  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\Copy of Jones Newsletter 0708.xls  /q/f
del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\Copy of MD L-Listing 07_11_08.xls  /q/f

2 个答案:

答案 0 :(得分:13)

将文件名放在双引号之间......(例如“D:\ My Program \ test.exe”)

答案 1 :(得分:9)

我将假设这是因为这一行:

del D:\DP-Production\Administrative\BUSINESS\FileLink\Mail\ BOBBSS    LIST COUNT - DRIBOX 2008-06 ejs.msg  /q/

注意那里的空间,它说:删除该文件夹中的所有内容,然后删除名为BOBBSS的文件,然后删除名为LIST的文件,然后删除名为COUNT的文件,然后是......嗯,错误,然后是名为DRIBOX的文件,等

执行Vincent Van Den Berghe所说的内容,使用“围绕文件名。