hi batch scripters!!
i need to list out the jan.doc in full path but doesn't want to include the subfolders with the same filename..
for example,
c:\documents\report\2008\jan.doc
c:\documents\report\2009\jan.doc
c:\documents\report\jan.doc
below is my scripts but doesn't output the desire result,
dir /s /b c:\documents\*.doc> list.txt
it outputs like below,
list.txt (not this)
--------------------content-------------------
c:\documents\report\2008\jan.doc
c:\documents\report\2009\jan.doc
c:\documents\report\jan.doc
--------------------content end---------------
and if my remove the /s in my scripts, it will output as below,
list.txt (not this)
-----------------content---------------------
jan.doc
-----------------content end-----------------
all i need is just like below,
list.txt
-----------------content---------------------
c:\documents\report\jan.doc <- like this
-----------------content end-----------------
include the full path of the files in that folder but excluding
the files in the subfolders with the same filenames!!!
any idea!! thanks
List out but excluding same filenames from subfolders!!
Moderator: DosItHelp
-
- Expert
- Posts: 391
- Joined: 19 Mar 2009 08:47
- Location: Iowa
Re: List out but excluding same filenames from subfolders!!
for /f "delims=" %%a in ('dir /a-d /b "c:\documents\*.doc"') do echo c:\documents\%%a>>list.txt