Re: For Command - can I do IN clause: ('cmd 1 & cmd 2') ???
- From: "Pegasus \(MVP\)" <I.can@xxxxxxx>
- Date: Wed, 13 Sep 2006 13:10:13 +1000
The three-line batch file below will list all files in each
of the subdirectories that hang off the current directory.
It will then list every file stored in the current directory.
@echo off
for /d %%d in (*.*) do for /F "tokens=*" %%* in ('dir "%%d" /B /a-d /S
/O:N') do echo %%*
for /F "tokens=*" %%* in ('dir /B /a-d /O:N') do echo %cd%\%%*
"dino" <dino@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1C49D996-0D62-44F8-AC68-0CA6383B5CC9@xxxxxxxxxxxxxxxx
Thanks again for your perseverance.in
I need to parse each line of a list of files. The list must be presented
the order I originally described as they partially, functionaly "overlap"one
another and my precedane requirements will be then met.and
As I said the list must be in this order:
I am trying to get a listing of all files in the directory structure at
below the <current directory> - BUT I need to see the files in the<current
directory> LAST i.e. after all of the sub directories and theirdescendants.
I need this because when filenames appear more than once, the <currentdo
directory takes precedence) otherwise they are to be considered in alpha
order.
"Pegasus (MVP)" wrote:
I'm sure there is a way to do what you want to do.
So far you have presented your partial solutions,
which you say do not work properly. Instead you
should start with a description of your ***functional
requirements***:
In other words: What exactly do you expect your
command to do?
"dino" <dino@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:78002FAE-CF94-44DC-9192-B493CF18DF35@xxxxxxxxxxxxxxxx
Thanks for your help Pegasus but while your answer works, (although I
thenot
think you need the first dir /AD and you meant /A:D not /A:-D on
passlast
dir) it still is two commands as I had at first and does not let me
')two
commands to an outer wrapping for command.
I need to parse the files in the generated list.
SO is there a syntax whereby I can do: ('dir . /A:D /B /S /O:N & cd
')or your simpler
('for /d %%a in (*.*) do dir "%%a" /B /S /O:N & dir /A:-D /B /S /O:N
files
As a commnd IN lcause to an outer for statement?
for /F %Q in ('( dir . /A:D /B /S /O:N & cd )')
do (for /F %R in ('dir %Q\*.* /A:-D /B')
do echo %~fxR )
"Pegasus (MVP)" wrote:
"dino" <dino@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:BAD9E0E2-009A-40D2-B360-7E7B7C648F4E@xxxxxxxxxxxxxxxx
I am sorry maybe I was unclear:
I need to see all the files in the subdirectories BEFORE I see the
in
the <CURRENT DIRECTORY>
SO if I am at the root and i have files/directories as follows
\dog.txt
\cat.txt
\mouse.txt
\bird.txt
\fourLeggedAnimals\dog.txt
\fourLeggedAnimals\cat.txt
\fourLeggedAnimals\mouse.txt
\pets\dog.txt
\pets\cat.txt
\pets\mouse.txt
\pets\bird.txt
\twoLeggedAnimals\bird.txt
I need to process the files in this order:
\fourLeggedAnimals\dog.txt
\fourLeggedAnimals\cat.txt
\fourLeggedAnimals\mouse.txt
\pets\dog.txt
\pets\cat.txt
\pets\mouse.txt
\pets\bird.txt
\twoLeggedAnimals\bird.txt
\dog.txt
\cat.txt
\mouse.txt
\bird.txt
That is why I want to do
dir . /A:D /B /S /O:N to first get me the list of subdirectories
then cd to get me the name of the <current directory>
yielding:
\fourLeggedAnimals\
\pets\
\twoLeggedAnimals\
\
Then I can do a dir on each of these directories
dir \fourLeggedAnimals\
dir \pets\
dir \twoLeggedAnimals\
dir \
yielding me the highest level directory last
This is just as simple:
@echo off
dir /AD
for /d %%a in (*.*) do dir "%%a" /B /S /O:N
dir /A:-D /B /S /O:N
.
- References:
- Re: For Command - can I do IN clause: ('cmd 1 & cmd 2') ???
- From: Pegasus \(MVP\)
- Re: For Command - can I do IN clause: ('cmd 1 & cmd 2') ???
- From: Pegasus \(MVP\)
- Re: For Command - can I do IN clause: ('cmd 1 & cmd 2') ???
- From: dino
- Re: For Command - can I do IN clause: ('cmd 1 & cmd 2') ???
- From: Pegasus \(MVP\)
- Re: For Command - can I do IN clause: ('cmd 1 & cmd 2') ???
- From: dino
- Re: For Command - can I do IN clause: ('cmd 1 & cmd 2') ???
- Prev by Date: Re: EMERGENCY! Automatic update still running after 2 hours
- Next by Date: Re: Scheduled Tasks
- Previous by thread: Re: For Command - can I do IN clause: ('cmd 1 & cmd 2') ???
- Next by thread: Re: What does the house icon mean?
- Index(es):
Relevant Pages
|
|