#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2009
    Posts
    1
    Rep Power
    0

    Emptying a folder, not delete it.


    Hi!
    Im trying to get a script running.
    It should be able to delete all folders and files in a dir, Not delete the root folder.

    Ive searched for a script like this, but come up empty, exept for this.. ive modifyed it slightly..

    dir /b /ad c:\test > dirlist.txt
    for /f %%i in (dirlist.txt) do rd /s /q c:\test\%%i
    del c:\test\*.*

    This does the job, exept if a folder has "space" in it
    "c:\test\New Folder"
    it can not delete that folder.

    In the end the script would act as follows,
    COPY all Folders and Files
    FROM "%USERPROFILE%"\Desktop
    TO c:\Death
    DELETE all folders and Files from "Desktop"(Not deleting Desktop)

    After that i will manually go through "Death" and keep what is worth keeping.

    Please help.
    /blippo
  2. #2
  3. Moderator Emeritus
    Devshed Supreme Being (6500+ posts)

    Join Date
    Feb 2002
    Location
    Austin, TX
    Posts
    7,188
    Rep Power
    2265
    What programming language are you writing this in?
    DrGroove, Devshed Moderator | New to Devshed? Read the User Guide | Connect with me on LinkedIn

IMN logo majestic logo threadwatch logo seochat tools logo