Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Need help creating a specific batch  (Read 2380 times)

0 Members and 1 Guest are viewing this topic.

blu22

  • Guest
Need help creating a specific batch
« on: August 21, 2008, 04:35:08 PM »
I just need a simple batch that will go 2 directories deep and delete files that lack specific values in their name.

ex.
ball.mp3
cat.mp3
(small)ball.mp3
(small)cat.mp3

from this list I would like to delete the objects that do NOT have (small) in their name.

Thanks a lot

also what book do you recommend for learning how to write .bat files effectively

ehsan_08



    Rookie

    Re: Need help creating a specific batch
    « Reply #1 on: August 22, 2008, 04:19:44 AM »
    this might not help much:

    Code: [Select]
    http://www.freedownloadscenter.com/Utilities/File_Maintenance_and_Repair_Utilities/Flash_Renamer.html

    fireballs



      Apprentice

    • Code:Terminal
    • Thanked: 3
      Re: Need help creating a specific batch
      « Reply #2 on: August 22, 2008, 04:34:11 AM »
      try this for the batch file:

      Code: [Select]
      @echo off
      set /p comm= what are you looking to delete?
      for /f "tokens=* delims=" %%A in ('dir /b /a:d') do (
      cd %CD%\%%A
      erase /s %comm%*.mp3
      )
      pause

      as for learning to write batch files... experiment that's what i do and always don't be afraid to ask.

      EDIT: if your going to experiment, especially with deleting things... make a backup!

      FB
      Next time google it.