Solved

Batch file not deleting files

Posted on 2007-04-06
4
202 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
VB6 Compile Compatibility Issue 4 90
windows xp doesn't save rdp credentials?doesn't save pass how can i fix this? 17 86
User profile Size Report 3 65
Advice in Xamarin 21 57
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
A short article about a problem I had getting the GPS LocationListener working.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
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 …

864 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

20 Experts available now in Live!

Get 1:1 Help Now