🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: microsoft.public.win2000.cmdprompt.admin
1 messages
1 total messages Started by Daniel Deight Tue, 26 Apr 2022 19:17
Create folders and files from txt row by row with batch script
#1
Author: Daniel Deight
Date: Tue, 26 Apr 2022 19:17
29 lines
2522 bytes
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.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads