Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Batch file not deleting files

Posted on 2007-04-06
4
Medium Priority
?
211 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 800 total points
ID: 18867653
Use

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

Assisted Solution

by:sirbounty
sirbounty earned 800 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 400 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
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 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…

721 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