Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Create folders and files from txt row by row with batch script

20 views
Skip to first unread message

Daniel Deight

unread,
Apr 26, 2022, 3:17:11 PM4/26/22
to
Hi everyone,
i came across this group. I've been thinking about a simple batch script for a week now... Unsuccessfully :(

Nobody helps me on the stackoverflow... i am beginner.

My script:

@echo offSETLOCALfor /f "delims=" %%l in (content.txt) do (for /f "tokens=1" %%a in (folders.txt) do (if not exist "%%a" mkdir "%%a"ECHO %%l>%%a\item.cs.md))

My question:

- I need to create folders according to the list in folders.txt 
- Create an item.cs.md file in the folders.
- Write the content from the content.txt file to the file one by one. 

I can do the first two points, I have a problem with the last point, the content of the file always fills only the last line.
if I understand correctly, sctipt always finishes at the end and the last line remains unwritten, until then the content is overwritten.
How to solve it?

https://stackoverflow.com/questions/71916974/create-folders-and-files-from-txt-batch-script

Thanks for your time and tips.
0 new messages