Solved

Batch file not deleting files

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

810 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