deleting files but leaving folders intact

G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Greetings

I would like to know how to delete files & folders inside a specific folder
without having to manualy go into each folder and delete it myself, reason
being is there are over 1600 of them....

The existing structure is like this

studentsprofiles$\year\%username%\ <-anything below this needs to be deleted.

The folder %username% is a default users profile folder, i need to delete
whats in this folder but to keep the main profile folder with its permissions.

Please could anyone let me know how this can be done via script(which i dont
know how to do) or batchfile..

Many thanks.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Hi, James.

I'm not sure I understand your whole problem, but in your batch file (run
from the "DOS" window or a Command Prompt, I assume), you can use the rd (or
rmdir) command with the /s parameter. As with any command in the "DOS"
window, type the command followed by /? to see a mini-Help file showing all
the switches and parameters available with that command.

Rd /? shows only /s and /q. The /s switch removes the named folder,
including all the files and subfolders within it, after asking "Are you
sure?" The /q skips the question and removes it all immediately.

I don't really recall how to do this for many different <foldernames> in
succession, because I haven't written any serious batch file in years. You
would use a for...next loop, feeding it a folder name at a time from a list
in a text file, I suppose, but I'll leave this step for someone else. ;^}

Hmm... I reread your question. It asks about profiles and permissions,
which I know nothing about. (As just one guy with one computer and no user
but me, I haven't had to learn about those.)

RC
--
R. C. White, CPA
San Marcos, TX
rc@corridor.net
Microsoft Windows MVP

"james.johnson" <james.johnson@cantell.southampton.sch.u k> wrote in message
news:5F917012-635F-4841-9AE8-0B5510366780@microsoft.com...
> Greetings
>
> I would like to know how to delete files & folders inside a specific
> folder
> without having to manualy go into each folder and delete it myself, reason
> being is there are over 1600 of them....
>
> The existing structure is like this
>
> studentsprofiles$\year\%username%\ <-anything below this needs to be
> deleted.
>
> The folder %username% is a default users profile folder, i need to delete
> whats in this folder but to keep the main profile folder with its
> permissions.
>
> Please could anyone let me know how this can be done via script(which i
> dont
> know how to do) or batchfile..
>
> Many thanks.
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

On Mon, 24 Jan 2005 08:19:06 -0800, "james.johnson" <james.johnson@cantell.southampton.sch.u k> wrote:

>Greetings
>
>I would like to know how to delete files & folders inside a specific folder
>without having to manualy go into each folder and delete it myself, reason
>being is there are over 1600 of them....
>
>The existing structure is like this
>
>studentsprofiles$\year\%username%\ <-anything below this needs to be deleted.
>
>The folder %username% is a default users profile folder, i need to delete
>whats in this folder but to keep the main profile folder with its permissions.
>
>Please could anyone let me know how this can be done via script(which i dont
>know how to do) or batchfile..
>
>Many thanks.


See Deltree at tip 617 in the 'Tips & Tricks' at http://www.jsiinc.com

Jerold Schulman
Windows Server MVP
JSI, Inc.
http://www.jsiinc.com
 
G

Guest

Guest
Archived from groups: microsoft.public.win2000.file_system (More info?)

Thanks for all your help guys. I know batch files reasonably well. I will
give it a try.

regards
James