Solved

Batch file not deleting files

Posted on 2007-04-06
4
199 Views
Last Modified: 2010-04-16
Trying to create a batch script where all files are deleted from a folder but the script is not functioning.  The script is del f:\deleted in 10 days\*.* and we use this format for other folders and different drives but this one will not function.  Problem with the spaces in the name of the folder??  Any assistance offered would be greatly appreciated.  
0
Comment
Question by:regsamp
4 Comments
 
LVL 58

Accepted Solution

by:
amit_g earned 200 total points
ID: 18867653
Use

del "f:\deleted in 10 days\*.*"
0
 
LVL 67

Assisted Solution

by:sirbounty
sirbounty earned 200 total points
ID: 18867667
You can also use the 8.3 version:

dir f: /x will list this, but this would probably work for the above:

del f:\delete~1\*.*
0
 
LVL 32

Assisted Solution

by:and235100
and235100 earned 100 total points
ID: 18870250
I would use vbscript -

---------------------------Start of Script ----------------------

DeleteFile "f:\deleted in 10 days\*.*"

function DeleteFile(WhatFile)
on Error Resume Next
dim fso
set fso=createobject("Scripting.Filesystemobject")
fso.DeleteFile(WhatFile)
End Function

---------------------End of Script--------------------
p.s - You will need windows scripting host installed - http://www.microsoft.com/downloads/details.aspx?FamilyId=C717D943-7E4B-4622-86EB-95A22B832CAA&displaylang=en

Is this what you want - or do you definitely want a batch file?
0
 

Author Comment

by:regsamp
ID: 18875000
Well, I will try the batch file first and if no go then I will try VB.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now