Solved

Batch file not deleting files

Posted on 2007-04-06
4
208 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
In this post we will learn different types of Android Layout and some basics of an Android App.
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 …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

728 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