• Welcome to Tux Reports: Where Penguins Fly. We hope you find the topics varied, interesting, and worthy of your time. Please become a member and join in the discussions.

Delete all files except one folder

S

surferdude2

Flightless Bird
Here's how it worked:

BEFORE:

Code:
--------------------
F:/projects>tree /f
Folder PATH listing for volume f10gig D2P1
Volume serial number is 0006EE44 E48B:68F4
F:.
¦ deleteme.txt
¦
+---Project001
¦ ¦ deleteme.txt
¦ ¦
¦ +---Source
¦ keepme.txt
¦
+---project002
¦ ¦ deleteme.txt
¦ ¦
¦ +---source
¦ keepme.txt
¦
+---Project111
¦ ¦ deleteme.txt
¦ ¦
¦ +---Source
¦ keepme.txt
¦
+---project222
¦ ¦ deleteme.txt
¦ ¦
¦ +---Source
¦ keepme.txt
¦
+---project999
¦ deleteme.txt
¦
+---source
keepme.txt
--------------------


AFTER:

Code:
--------------------
F:/projects>tree /f
Folder PATH listing for volume f10gig D2P1
Volume serial number is 0006EE44 E48B:68F4
F:.
+---Project001
¦ +---Source
¦ keepme.txt
¦
+---project002
¦ +---source
¦ keepme.txt
¦
+---Project111
¦ +---Source
¦ keepme.txt
¦
+---project222
¦ +---Source
¦ keepme.txt
¦
+---project999
+---source
keepme.txt
--------------------


Does that look like what you are trying to achieve?
 
L

liu

Flightless Bird
> --------------------
>     xxcopy /clone /yy F:/projects\project???\source\*.* F:/projectsxxcopy
>   xxcopy /clone /yy F:/projectsxxcopy F:/projects\
>   RD F:/projectsxxcopy /s /q
> --------------------
>
> Use quotes if you have embedded spaces in your path.
>
> It simply copies all project folders to an intermediate folder and then
> clones that folder back to the original, thus deleting all files and
> folders except those named projects and source.
>
> xxcopy is a great time saver for situations like yours.


It worked. THANKS A LOT!!!
 
T

T Shadow

Flightless Bird
"surferdude2" <surferdude2.4cpf8q@no.email.invalid> wrote in message
news:surferdude2.4cpf8q@no.email.invalid...
>
> Consider using the freeware 'XXCOPY'
> (http://www.xxcopy.com/xcpymain.htm) to do that job.
>
> I created a structure similar to what you described and did a quick
> batch file. It seems to do what you want:
>
>
> Code:
> --------------------
> xxcopy /clone /yy F:/projects\project???\source\*.* F:/projectsxxcopy
> xxcopy /clone /yy F:/projectsxxcopy F:/projects\
> RD F:/projectsxxcopy /s /q
> --------------------
>
>
> Use quotes if you have embedded spaces in your path.
>
> It simply copies all project folders to an intermediate folder and then
> clones that folder back to the original, thus deleting all files and
> folders except those named projects and source.
>
> xxcopy is a great time saver for situations like yours.
>


I think shools should test students for criminal apptiude so they know they
aren't cut out for it and can lead more productive lives. Doubtful time in a
correctional facility will cure you and the citizens will be paying for your
keep the rest of your life. Wasting other peoples lives too, your family
included. I'd say 240grains of lead is the only thing to cure the two of
you. Don't really care if that's not what the two of you are doing.
Spreading this kind of crap makes you guilty too.

http://www.missingkids.com/

Anyone still wondering why newsgroups are going away.
 
J

Jim

Flightless Bird
On Fri, 18 Jun 2010 05:42:45 -0400, "T Shadow" <None@void.com> wrote:

>"surferdude2" <surferdude2.4cpf8q@no.email.invalid> wrote in message
>news:surferdude2.4cpf8q@no.email.invalid...
>>
>> Consider using the freeware 'XXCOPY'
>> (http://www.xxcopy.com/xcpymain.htm) to do that job.
>>
>> I created a structure similar to what you described and did a quick
>> batch file. It seems to do what you want:
>>
>>
>> Code:
>> --------------------
>> xxcopy /clone /yy F:/projects\project???\source\*.* F:/projectsxxcopy
>> xxcopy /clone /yy F:/projectsxxcopy F:/projects\
>> RD F:/projectsxxcopy /s /q
>> --------------------
>>
>>
>> Use quotes if you have embedded spaces in your path.
>>
>> It simply copies all project folders to an intermediate folder and then
>> clones that folder back to the original, thus deleting all files and
>> folders except those named projects and source.
>>
>> xxcopy is a great time saver for situations like yours.
>>

>
>I think shools should test students for criminal apptiude so they know they
>aren't cut out for it and can lead more productive lives. Doubtful time in a
>correctional facility will cure you and the citizens will be paying for your
>keep the rest of your life. Wasting other peoples lives too, your family
>included. I'd say 240grains of lead is the only thing to cure the two of
>you. Don't really care if that's not what the two of you are doing.
>Spreading this kind of crap makes you guilty too.
>
>http://www.missingkids.com/
>
>Anyone still wondering why newsgroups are going away.
>



WindowsXP ???????????????????????????
 
S

surferdude2

Flightless Bird
liu;1222390 Wrote:
> > --------------------
> > * * xxcopy /clone /yy F:/projects\project???\source\*.*

> F:/projectsxxcopy
> > * xxcopy /clone /yy F:/projectsxxcopy F:/projects\
> > * RD F:/projectsxxcopy /s /q
> > --------------------
> >
> > Use quotes if you have embedded spaces in your path.
> >
> > It simply copies all project folders to an intermediate folder and

> then
> > clones that folder back to the original, thus deleting all files and
> > folders except those named projects and source.
> >
> > xxcopy is a great time saver for situations like yours.

>
> It worked. THANKS A LOT!!!


XXCOPY is a powerful tool - use it with caution! It is extremely
important to always include a target folder other than the root folder
when using the /clone switch, especially if including the /yy switch
which prevents any confirmation prompts. Cloning to a target root
folder will wipe all data from the target folder and replace it with the
source data. That's not what is usually desired, to say the least.

All the best,

Dude
 
B

Billns

Flightless Bird
On 6/18/2010 2:42 AM, T Shadow wrote:
> "surferdude2"<surferdude2.4cpf8q@no.email.invalid> wrote in message
> news:surferdude2.4cpf8q@no.email.invalid...
>>
>> Consider using the freeware 'XXCOPY'
>> (http://www.xxcopy.com/xcpymain.htm) to do that job.
>>
>> I created a structure similar to what you described and did a quick
>> batch file. It seems to do what you want:
>>
>>
>> Code:
>> --------------------
>> xxcopy /clone /yy F:/projects\project???\source\*.* F:/projectsxxcopy
>> xxcopy /clone /yy F:/projectsxxcopy F:/projects\
>> RD F:/projectsxxcopy /s /q
>> --------------------
>>
>>
>> Use quotes if you have embedded spaces in your path.
>>
>> It simply copies all project folders to an intermediate folder and then
>> clones that folder back to the original, thus deleting all files and
>> folders except those named projects and source.
>>
>> xxcopy is a great time saver for situations like yours.
>>

>
> I think shools should test students for criminal apptiude so they know they
> aren't cut out for it and can lead more productive lives. Doubtful time in a
> correctional facility will cure you and the citizens will be paying for your
> keep the rest of your life. Wasting other peoples lives too, your family
> included. I'd say 240grains of lead is the only thing to cure the two of
> you. Don't really care if that's not what the two of you are doing.
> Spreading this kind of crap makes you guilty too.
>
> http://www.missingkids.com/
>
> Anyone still wondering why newsgroups are going away.
>
>

Hey, Shadow, if you don't understand what these people are doing, just
keep quiet, please.
 
Top