Results 1 to 9 of 9

Thread: spawning (del command) DOS 7

  1. #1

    spawning (del command) DOS 7

    I want to create a batch file that will delete all gid files throughout my hard drive.

    looking at the deltree command:

    Deltree
    Deletes a directory and all the subdirectories and files in it.

    Syntax:
    To delete a directory and all the subdirectories and files contained therein:
    DELTREE [/Y] directory

    Obviously not only will it delete files but also directorys, not what I want at all.

    I could try something like:

    del c:\*.gid

    but that would only delete gid files in a single directory not all sub directorys. I would asume this would not be dificult, useing perl I couldeasily do this kind of thig, but Im talking batch not perl.

    Does someone know if there is a way to delete not only gid files under root but all sub directorys as well, I know in linux you can spesify the -r option to ask for recursive deletion.

    Sugestions are welcomed.
    test

  2. #2
    Senior Member
    Join Date
    Aug 2001
    Posts
    485
    I don't think there is an easy way of doing this.

    What I have used in the past is the following command (from c:\)

    DIR *.gid /s /w >temp.txt

    This will list all the gid files, and save them in the temp.txt file

    However, you will now need a program (any language like perl will do, as the output from this is very easy to process) to read the temp.txt file and change it into a series of DEL commands, which you can then execute as a batch file.

    If you only have a few, then you can just print out or view the temp.txt and delete them manually.

    No recursive option in DOS

  3. #3
    Junior Member
    Join Date
    Aug 2002
    Posts
    5
    Do you have to use DOS? The windows9x find will track down all the *.gid files (Search in windows 2000.) Then just delete what shows up. If you must use DOS try "DIR *.GID /S >giddel.bat" Then edit the file appending each line with del. Also, you will need to remove the size and date info. This would be the hard way, but I suppose if you have a lot of files to delete . . .

    There was an old shareware program called Sweep that would help if it can still be found. It would display all the files and directories on the HD. You could then "tag" them then delete, move, copy . . .

    Sorry, I am not a lot of help, but you are asking a dinosaur to remember old tricks.

    With our Lords blessings take care,

    Doug

  4. #4
    Senior Member
    Join Date
    Nov 2001
    Posts
    742

    Re: spawning (del command) DOS 7

    Originally posted here by aj67my
    I want to create a batch file that will delete all gid files throughout my hard drive.

    Does someone know if there is a way to delete not only gid files under root but all sub directorys as well, I know in linux you can spesify the -r option to ask for recursive deletion.

    Sugestions are welcomed.
    This should do the job if you not have a strange version of dos

    Code:
    :: Deletes all .gid files on your C: drive.
    
    c:
    cd \
    del *.gid /s
    ~micael

  5. #5
    Senior Member
    Join Date
    Aug 2001
    Posts
    485

    Re: Re: spawning (del command) DOS 7

    Originally posted here by micael


    This should do the job if you not have a strange version of dos

    Code:
    :: Deletes all .gid files on your C: drive.
    
    c:
    cd \
    del *.gid /s
    ~micael
    AFAIK this does not work (unless you are running some strange version of DOS that I don't know about)

  6. #6
    Junior Member
    Join Date
    Aug 2002
    Posts
    5
    I've been away from DOS too long. When did Bill sneak that one in?

  7. #7
    Senior Member
    Join Date
    Nov 2001
    Posts
    742
    This does work under NT, 2K, XP not sure about switches under 9x.

  8. #8
    Senior Member
    Join Date
    Jun 2002
    Posts
    405
    Yeah, the /s switch is not part of 9x - what version Windows are you using aj67my?

  9. #9
    windows 98 SE, is what I am running so unfortunately I wont be able to use the s option,

    I could verywell make a perl script that would do the task, or as sugested directory listing into a file, then use a script to read the file and execute a del comand for each file found. I am going to see if somewhere I can download the del command that comes with Windows XP, and replace mine with the new one, that might work.

    I know that you can download the defrag that comes with Windows ME and replace the one in Win 98 with the one that Win ME has and it will run faster, aparently the defrag in Win me and above was writen beter.

    So maybe appling that concept a simple replacement in my c:\windows\command directory may work. Or I could write my own dir command, and replace.

    Thanks very much for the sugestions.
    test

Posting Permissions

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