| 1. |
Solve : Deleting Files Based on File Name? |
|
Answer» I am trying to create a batch file to delete all files in a directory (including subdirectories) in which the 5th and 6th characters in the file name are equal to "09". The file names are based on a date code and I want to delete files based on certain dates. If someone could point me in the right direction it would be GREATLY appreciated.This can be done in a FOR LOOP. I am trying to create a batch file to delete all files in a directory (including subdirectories) in which the 5th and 6th characters in the file name are equal to "09". The file names are based on a date code and I want to delete files based on certain dates. If someone could point me in the right direction it would be greatly appreciated.Code: [Select]del ????09*.* /s Thank you BC. It was much to complex for me. He used numbers instead of pictures. I am not good with numbers.Well that was easy! Thanks both of you for your help. I wasn't aware of the ? placeholder. I was thinking more of a couple If Then statements that used DOS's version of Mid String (if such a thing exists). I was making it way harder than it needed to be. I am not permanently DELETING the files by the way. Before running this I am making a copy of all of the files, then just going into the copy and deleting specific files. Then going into the ORIGINAL copy and deleting the other ones. I'm sure this can all be done in a single batch file, but I only need to do it once. Thanks!I would suggest that a filter be applied to make the files hidden. Most program will not include hidden files in a precess of preparing a report. If that is what you want.Quote from: Geek-9pm on May 17, 2012, 01:38:09 PM I would suggest that a filter be applied to make the files hidden. Most program will not include hidden files in a precess of preparing a report. If that is what you want.I don't recall the user requesting to do anything with hidden files. |
|