2 Replies - 1268 Views - Last Post: 02 July 2013 - 03:26 PM Rate Topic: -----

#1 Xaviorin  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 21
  • Joined: 17-January 13

batch file to find and delete file names in directory

Posted 29 June 2013 - 11:01 AM

I have no idea what forum this goes in because I didn't see a dos forum. Sorry ahead of time.

I want to create a batch file for windows that when placed in a folder will search the root and all sub folders of that directory for file names that have the current date in the file name. For example all files that have "06282013" in their names will get deleted. I know batch files are cmd line commands but after looking through the tutorials on this site I don't feel I have enough information to even begin this or to even know if what I'm hoping to do is possible. If anyone could guide me, link me, or instruct me on this I would be extremely greatful. Thanks everyone.

Is This A Good Question/Topic? 0
  • +

Replies To: batch file to find and delete file names in directory

#2 JackOfAllTrades  Icon User is offline

  • Saucy!
  • member icon

Reputation: 6092
  • View blog
  • Posts: 23,612
  • Joined: 23-August 08

Re: batch file to find and delete file names in directory

Posted 29 June 2013 - 11:07 AM

Moved to Other Languages
Was This Post Helpful? 0
  • +
  • -

#3 #define  Icon User is offline

  • Duke of Err
  • member icon

Reputation: 1398
  • View blog
  • Posts: 4,873
  • Joined: 19-February 09

Re: batch file to find and delete file names in directory

Posted 02 July 2013 - 03:26 PM

Hi, you can type help at the command line, and there are tutorials etc online.

I searched for dos batch currdate and found

How to set date to current date using dos batch file command

Command extensions like /R should work

@echo off

set currdate=%date:/=%
echo %currdate%

set ext=txt

for /R %%F in (*.%ext%) do echo "%%F" 



Depending on the value of the files, you may wish to move them to a temp folder for a period.
'

This post has been edited by #define: 02 July 2013 - 03:33 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1