| 1. |
Solve : Batch file to delete file? |
|
Answer» Hello, I tried your script in a temporal folder and it deleted all files including it self and leaving justIf the batch file deleted itself then you didn't FOLLOW my instructions!!!! Based on the information you gave me the script works as described. Until you can supply more information on what folder the files are in and what files are in the folder and what files need to remain and what files need to be deleted there is little anyone can do to help you. You need to think about what you are trying to do and be very specific with your instructions.Squashman, I suspect Akod doesn't have the knowledge to change this line: Code: [Select]pushd "c:\folder path" Akod - you must have failed to comprehend the instructions - why didn't you ask a question describing which part you didn't UNDERSTAND?Below is a description of the files in this location where the latest file is to be deleted: Control3.dmp > (Time of creation 11:26pm) Control2.dmp > (Time of creation 5:45pm) schedule2 > (folder) Schedule3 > (folder) schedule > (folder) The directory contains 2 files and 3 folders. The application we running automatically generates the two files at the time indicated above. Because of low disk ISSUE, anytime a file is created, the old one needs to be deleted. Please hope this explanation helps to get a solution. Thanks. You didn't answer all my questions but this again is the best I can do with the limited information. Code: [Select]echo off pushd "c:\folder path" FOR /F "skip=1 delims=" %%G in ('dir /a-d /b /o-d control*.dmp') do del "%%~G" popd |
|