deleting folders

Home Forums Scripting DOS Command Shell deleting folders

This topic contains 6 replies, has 4 voices, and was last updated by Avatar 1tim6.11 9 years, 1 month ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • Avatar
    shmengie
    Member
    #151208

    okay, this has to be the simplest thing ever, yet, it eludes me.

    i have a scheduled task that runs once a week which calls a batch file. the batch file has the line:del v:*.* /s /q[/CODE]where v is a mapped share.

    this runs perfectly, except, it leaves behind all my empty folders and their subs. i suppose i could add a line like[CODE]rd *.*[/CODE] but after googling, i don’t think rd supports wildcards.

    i found some wsh solutions, but that sure seems to be beyond the scope of just having the del *.* command do what i want. like i said, this has to be the simplest thing ever. apparently, though, not as simple as me!

    tia[CODE]del v:*.* /s /q[/CODE]where v is a mapped share.

    this runs perfectly, except, it leaves behind all my empty folders and their subs. i suppose i could add a line likerd *.*[/CODE] but after googling, i don’t think rd supports wildcards.

    i found some wsh solutions, but that sure seems to be beyond the scope of just having the del *.* command do what i want. like i said, this has to be the simplest thing ever. apparently, though, not as simple as me!

    tia[CODE]rd *.*[/CODE] but after googling, i don’t think rd supports wildcards.

    i found some wsh solutions, but that sure seems to be beyond the scope of just having the del *.* command do what i want. like i said, this has to be the simplest thing ever. apparently, though, not as simple as me!

    tia

    Avatar
    1tim6.11
    Member
    #375680

    Re: deleting folders

    I think the command you want to look into is deltree

    http://en.wikipedia.org/wiki/Deltree

    Avatar
    georgeeye
    Member
    #362049

    Re: deleting folders

    depending on the OS version deltree may or may not be available, and no rd does not support wild cards.

    Are your directories always named the same thing? If so then it’s scriptable, easily, if not then you will have to use some for and if exist statements to clear it.

    Avatar
    1tim6.11
    Member
    #375681

    Re: deleting folders

    georgeeye;218101 wrote:
    depending on the OS version deltree may or may not be available

    True . . . but you can find a copy of it and it will run on Windows Server 2008. I have not confirmed other OS versions, but I would imagine if it functions on Windows Server 2008, that other versions should run as well.

    Avatar
    shmengie
    Member
    #247199

    Re: deleting folders

    yeah, i had thought of deltree, but it doesn’t exist on w2k3. i hadn’t, however, thought of copying over the executable. i’ll be an s.o.b. though if i can figure out where i’m going to get it from. bit torrent? anyone got dos 6.0 lying around?

    as for scripting, once i get the folders deleting automatically, yeah, i should know exactly what they’ll be called every time. would this script just need to know the parent folder name? or all the subs, as well?

    thx for your input so far, guys!

    Avatar
    georgeeye
    Member
    #362050

    Re: deleting folders

    Here’s a dowload link http://terrikaduck.netfirms.com/deltree.htm I grabbed it and tested it on xp seems to work fine.

    As for the scripting it should only need parent folder names, since you want to wipe everything out each time the script is ran.

    Avatar
    vonPryz
    Member
    #347488

    Re: deleting folders

    shmengie;218078 wrote:
    i found some wsh solutions, but that sure seems to be beyond the scope of just having the del *.* command do what i want.

    How about running quick format for the volume, if all you wish to do is to delete all the files and directories?

    A BAT solution can be made by using dir /a:d /b and redirecting its output. Powershell makes this, of course, a lot easier. Can’t whack up a prototype, as I’m on my iMac at the moment,

    -vP

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.