Filestructure:
C:\test – map
C:\test – map\TEST - A
C:\test – map\TEST - A\A 1 TESTA-A 1.txt
C:\test – map\TEST - A\ A 2 TESTA-A2.txt
C:\test - map\TEST - B
C:\test - map\TEST - B\ B1 TEST - B-B1.txt
C:\test - map\TEST - B\ B–2 TEST - B-B2.txt
C:\test - map\TEST - B\ B2 \ C1 TEST - B-B2-C1.txt
C:\test – map\TEST - B\B2\ C2\file1.txt + file2.txt TEST - B-B2-C2.txt
Wish:
I would like to have a batch file what could make a listing of all the filenames in to one txt file for each directory , sub dir and sub sub dir.
The TXT should be located in the directory which files it is listing.
Filename of TXT.File should be a combination of the subsequent directories.
For example: TEST – B-B2-C2.txt
Content of TXT File: TEST – B-B2-C2.txt
File1.txt
File2.txt
Well, any help would be appreciated.
DIR LIST of Files in EACH SUB Directory
Moderator: DosItHelp
RVDLD,
How about this:
DOS IT HELP?
How about this:
Code: Select all
@echo off
SETLOCAL ENABLEDELAYEDEXPANSION
set "StartDir=%userprofile%\"
for /f "delims=" %%A in ('dir /s /b /ad "%StartDir%"') do (
set "OutputFile=\\%%A"
set "OutputFile=!OutputFile:\\%StartDir%=!"
set "OutputFile=!OutputFile:\=-!
dir /b /a-d "%%A" > "__!OutputFile!.txt" 2>NUL
)
pause
DOS IT HELP?