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

Author Topic: Batch Delete Files And Folders  (Read 2290 times)

0 Members and 1 Guest are viewing this topic.

the_mad_joker

    Topic Starter


    Apprentice

    Thanked: 8
    Batch Delete Files And Folders
    « on: March 27, 2010, 10:41:42 AM »
    I Seriously Need Help My Friends ! I Am Making Dos Setup For Some Portable Programs

    I Want A Batch To Do The Foll Things -

    1] It Is In .\Other Folder But Should Be Exectued From "temp" Folder (Basically This Work Could Be Done By WRAR , But Still If Another Steps)


    2] After Execution It Should Delete The Files.ext And Folders In .\Other Folder.


    3] Lastly It Should Delete Itself And The .\Other Directory.

    greg



      Intermediate

      Thanked: 7
      Re: Batch Delete Files And Folders
      « Reply #1 on: March 27, 2010, 12:20:38 PM »
      1] It Is In .\Other Folder But Should Be Exectued From "temp" Folder (Basically This Work Could Be Done By WRAR , But Still If Another Steps)

      2] After Execution It Should Delete The Files.ext And Folders In .\Other Folder.

      3] Lastly It Should Delete Itself And The .\Other Directory.


      C:\batch>type joke27.bat
      Code: [Select]
      @echo off
      cd \
      md other
      cd other
      echo hello joker > joker27.txt
      md other2
      cd other2
      echo hello joker > joker28.txt

      cd \
      cd other
      Type  joker27.txt
      cd other2
      type joker28.txt
      cd \
      cd other
      cd other2
      del /Q *.*
      cd ..
      rd other2
      cd \
      del /Q  c:\other\*.*
      rd other

      rem mv c:\batch\joke27.bat  c:\temp\
      rem del c:\temp\joke27.bat

      Output:
      C:\batch>joke27.bat
      hello joker
      hello joker

      C:\>
      Have a Nice Day

      the_mad_joker

        Topic Starter


        Apprentice

        Thanked: 8
        Re: Batch Delete Files And Folders
        « Reply #2 on: March 27, 2010, 11:40:02 PM »
        Thanks Dude !!!!!