M
M
m4f12019-08-28 22:57:53
cmd/bat
m4f1, 2019-08-28 22:57:53

How to write the names of folders in a specified directory to a file?

Good evening! I ask for help in writing a bat program to extract the names of folders and nested subfolders into a text file (list).
There is a bat script

chcp 1251
@echo off
(for /f delims^= %%i in ('dir /b /s /a-d') do (
set "file=%%i"
call echo %%file:%cd%=%%
)) > list.txt

It outputs the names of folders and subfolders to a text file, but not in the right way.
\2)REPAIR OF APARTMENTS AND PRIVATE HOUSES\VIP-REPAIR\b1 (5).JPG
\2)REPAIR OF APARTMENTS AND PRIVATE HOUSES\VIP-REPAIR\b1 (7).JPG
\2)REPAIR OF APARTMENTS AND PRIVATE HOUSES\BALCONIES\170620092502 .jpg
\2)REPAIR OF APARTMENTS AND PRIVATE HOUSES\BALCONIES\20141003_065259.jpg
\2)REPAIR OF APARTMENTS AND PRIVATE HOUSES\BALCONIES\20141003_065304.jpg
\2)REPAIR OF APARTMENTS AND PRIVATE HOUSES\BALCONIES\20141003_065316.jpg

Bat connoisseurs, please help, I need an output with tabs, like
РЕМОНТ КВАРТИР И ЧАСТНЫХ ДОМОВ
     VIP- РЕМОНТ
     БАЛКОНЫ
СТРОИТЕЛЬСТВО ДОМОВ
     ДЕРЕВЯННЫЕ
     КИРПИЧНЫЕ

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
m4f1, 2019-08-29
@m4f1

Issue resolved, thanks sergey
kuzmin Run tree.exe with parameter '>filelist.txt'

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question