Sign in with
Sign up | Sign in
Your question

deleting files but leaving folders intact

Tags:
  • File System
  • Windows
Last response: in Windows 2000/NT
Share
Anonymous
January 24, 2005 11:19:06 AM

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.

More about : deleting files leaving folders intact

Anonymous
January 24, 2005 2:27:04 PM

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.
Anonymous
January 24, 2005 3:14:45 PM

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
Anonymous
January 25, 2005 7:11:05 AM

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
!