Good morning,
I have a problem to make lists of the files that are in the folders.
I have a folder that contains several folders inside, and within each subfolder there are several * .txt files. What I want is that within each subfolder there is a txt with the route information:
C:\TimeSeries\New folder\Archivo_1.txt
C:\TimeSeries\New folder\Archivo_2.txt
In the folder New folder a txt with the information above will appear. In the folder New folder 2 will appear:
C:\TimeSeries\New folder 2\Archivo_1.txt
C:\TimeSeries\New folder 2\Archivo_2.txt
This I can do by going into the subfolder (for example, in New folder ) and writing in the cmd:
dir/s/b *.txt > list_of_files.txt
But having many subfolders, I want to place myself in the folder that contains all the subfolders and with a command, a loop or something like that I go through all the subfolders and I save a txt file in each subfolder with the list of subfolders. corresponding files.
I'm not sure if it can be done.
Thank you!
Update:
To get the list of all the sub-folders with the full path you need to open the console in the folder that contains the subfolders and put the following:
for /f "delims=" %D in ('dir /a:d /b') do dir /s/b "%~fD\*.txt" > "%~fD\list_of_files.txt"