Announcement

Collapse
No announcement yet.

deleting folders

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • deleting folders

    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:
    Code:
    del v:\*.* /s /q
    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 *.*
    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
    Last edited by Wired; 27th September 2010, 23:43. Reason: removed irrelevant link

  • #2
    Re: deleting folders

    I think the command you want to look into is deltree

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

    Comment


    • #3
      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.

      Comment


      • #4
        Re: deleting folders

        Originally posted by georgeeye View Post
        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.

        Comment


        • #5
          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!

          Comment


          • #6
            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.

            Comment


            • #7
              Re: deleting folders

              Originally posted by shmengie View Post
              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

              Comment

              Working...
              X