Results 1 to 5 of 5

Thread: Need a little help with batch file

  1. #1
    Low Bitrate BlueGrimRX8's Avatar
    Join Date
    Dec 2004
    Location
    Jacksonville
    Posts
    56

    Need a little help with batch file

    I am trying to write a batch file that looks in all the directories withing a folder and deletes all the .xls files in all the folders.
    So I have folder structure
    Main Directory
    -Dir 1
    -Dir 2
    -Dir 3

    Inside each of those Dir's there are .xls files. I want to delete all of them, could someone help me write a batch file to do this?

    Thanks!!

  2. #2
    Low Bitrate
    Join Date
    Nov 2004
    Location
    Northern VA
    Posts
    87
    Quote Originally Posted by BlueGrimRX8
    I am trying to write a batch file that looks in all the directories withing a folder and deletes all the .xls files in all the folders.
    So I have folder structure
    Main Directory
    -Dir 1
    -Dir 2
    -Dir 3

    Inside each of those Dir's there are .xls files. I want to delete all of them, could someone help me write a batch file to do this?

    Thanks!!
    cd \"Main Directory" (quotes not needed if directory name has no spaces)

    cd "dir 1"
    del *.xls /q
    cd..
    cd "dir 2"
    del *.xls /q
    cd..
    cd "dir 3"
    del *.xls /q
    cd..
    exit

    Hope that helps

  3. #3
    Newbie paulpitchford's Avatar
    Join Date
    Jan 2005
    Location
    UK
    Posts
    24
    cd\yourdirectory <------ This is the root of your directory structure
    del *.xls /s

    Put that in your batch file and it should work.

    Thanks,

    Paul.
    Ford Transit 135 T350
    1Ghz Epia M10000 ITX
    OPUS 150w
    512MB DDR
    40GB HD
    7" Lilliput Touch Screen (Powered from Opus)

    0% Completed - Used to have this PC in my Ford Focus RS for fun but now I have it in my van for work! It's awsome!

  4. #4
    Low Bitrate BlueGrimRX8's Avatar
    Join Date
    Dec 2004
    Location
    Jacksonville
    Posts
    56
    Thanks paul thats exactly what I was looking for. Eleventh, that would have worked to but I have over 2000 subdirectories.

    Thanks guys knew somebody could help!!

  5. #5
    Low Bitrate
    Join Date
    Nov 2004
    Location
    Northern VA
    Posts
    87
    Quote Originally Posted by BlueGrimRX8
    Thanks paul thats exactly what I was looking for. Eleventh, that would have worked to but I have over 2000 subdirectories.

    Thanks guys knew somebody could help!!

    Gotcha - I didn't know if there were some directories in Yourdirectory that you didn't want to delete the .xls's in, that's why I didn't reccommend /s. Happy coding.

    Incidentally, if you want to turn your bacth file in to an exe check this out: http://www.bdargo.com/index.htm

Similar Threads

  1. batch file "pause" question
    By grandamp3 in forum Software & Software Development
    Replies: 11
    Last Post: 02-20-2008, 09:07 PM
  2. Bug Reports
    By frodobaggins in forum FrodoPlayer
    Replies: 168
    Last Post: 10-16-2004, 12:25 AM
  3. batch file programming LCD's
    By mosh in forum LCD/Display
    Replies: 6
    Last Post: 05-19-2002, 12:55 AM
  4. Program or batch file to control DTR on a serial port
    By percyt2k in forum Software & Software Development
    Replies: 7
    Last Post: 12-17-2001, 03:41 PM
  5. batch file playlist creation size limit?
    By AndyM in forum Software & Software Development
    Replies: 6
    Last Post: 08-08-2001, 12:06 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •