Hi,

I need your help.

There is a folder, it contains some subfolders and files.

I need to delete the files created 2days ago in this folder , I also need to
delete the files in the subfolders, but I do not need to delete the subfolder.

I have looked for the scripts in internet for a long time, but no result was
found.

Re: How to delete subfolders and files in a folder by McKirahan

McKirahan
Tue Jul 08 05:22:01 CDT 2008

"Haoqiang" <Haoqiang@discussions.microsoft.com> wrote in message
news:1CBBF2F0-ABE3-446B-947D-A2F3938FBF72@microsoft.com...
> Hi,
>
> I need your help.
>
> There is a folder, it contains some subfolders and files.
>
> I need to delete the files created 2days ago in this folder , I also need
to
> delete the files in the subfolders, but I do not need to delete the
subfolder.
>
> I have looked for the scripts in internet for a long time, but no result
was
> found.

Google this ng for:
"Deleting specific extensions files older than x days"
then combine the script there with one here:
"What about deleting sub-folders"



Re: How to delete subfolders and files in a folder by Pegasus

Pegasus
Tue Jul 08 06:53:02 CDT 2008


"Haoqiang" <Haoqiang@discussions.microsoft.com> wrote in message
news:1CBBF2F0-ABE3-446B-947D-A2F3938FBF72@microsoft.com...
> Hi,
>
> I need your help.
>
> There is a folder, it contains some subfolders and files.
>
> I need to delete the files created 2days ago in this folder , I also need
> to
> delete the files in the subfolders, but I do not need to delete the
> subfolder.
>
> I have looked for the scripts in internet for a long time, but no result
> was
> found.

Instead of re-inventing the wheel, you could use someone else's wheel:
xxcopy.exe /db#2 /rs /yy /ed /s "d:\My Files"
You can download xxcopy.exe from a number of sites.



Re: How to delete subfolders and files in a folder by Pegasus

Pegasus
Tue Jul 08 07:09:22 CDT 2008


"Haoqiang" <Haoqiang@discussions.microsoft.com> wrote in message
news:1CBBF2F0-ABE3-446B-947D-A2F3938FBF72@microsoft.com...
> Hi,
>
> I need your help.
>
> There is a folder, it contains some subfolders and files.
>
> I need to delete the files created 2days ago in this folder , I also need
> to
> delete the files in the subfolders, but I do not need to delete the
> subfolder.
>
> I have looked for the scripts in internet for a long time, but no result
> was
> found.
>

BTW, there appears to be a contradiction in your post. In the Subject line
you write "How to delete subfolders" but in the text you write "but I do not
need to delete the subfolder".



Re: How to delete subfolders and files in a folder by Haoqiang

Haoqiang
Wed Jul 09 10:03:02 CDT 2008

Thanks for your reply,Pegasus.
I do not need to delete the subfolders.
In this scenario,a folder named "abc" contains several subfolders named by
department.
I need to scan the "abc" folder to find files created or modified 2 days ago
and delete them.

I have downloaded XXCopy.exe and I will have a test tomorrow.
Thanks again!

Haoqiang


"Pegasus (MVP)" wrote:

>
> "Haoqiang" <Haoqiang@discussions.microsoft.com> wrote in message
> news:1CBBF2F0-ABE3-446B-947D-A2F3938FBF72@microsoft.com...
> > Hi,
> >
> > I need your help.
> >
> > There is a folder, it contains some subfolders and files.
> >
> > I need to delete the files created 2days ago in this folder , I also need
> > to
> > delete the files in the subfolders, but I do not need to delete the
> > subfolder.
> >
> > I have looked for the scripts in internet for a long time, but no result
> > was
> > found.
> >
>
> BTW, there appears to be a contradiction in your post. In the Subject line
> you write "How to delete subfolders" but in the text you write "but I do not
> need to delete the subfolder".
>
>
>