🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: microsoft.public.win2000.cmdprompt.admin
Article #1

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

#1
From: 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.
Technical Details
Message-ID: <9af9aaba-16c9-42b5-97fd-37f9d167aeafn@googlegroups.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!nnrp.usenet.blueworldhosting.com!!news.usenet.blueworldhosting.com!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <9af9aaba-16c9-42b5-97fd-37f9d167aeafn@googlegroups.com>
Subject: Create folders and files from txt row by row with batch script
Date: Tue, 26 Apr 2022 19:17:10 +0000
From: Daniel Deight <daniel@deight.eu>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!archive!apf9.newsdeef.eu!nnrp.usenet.blueworldhosting.com!!news.usenet.blueworldhosting.com!spool1.usenet.blueworldhosting.com!usenet.blueworldhosting.com!feed1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!weretis.net!feeder8.news.weretis.net!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
X-Received: by 2002:a05:6214:d69:b0:446:4e36:383e with SMTP id 9-20020a0562140d6900b004464e36383emr17297946qvs.71.1651000630820;
X-Received: by 2002:a25:8d90:0:b0:634:7136:4570 with SMTP id
 o16-20020a258d90000000b0063471364570mr22493287ybl.582.1651000630651; Tue, 26
Newsgroups: microsoft.public.win2000.cmdprompt.admin
Injection-Info: google-groups.googlegroups.com; posting-host=78.80.121.98; posting-account=l_-LPQoAAACxSeo5L3NuiAScTUKUTg1s
NNTP-Posting-Host: 78.80.121.98
User-Agent: G2/1.0
MIME-Version: 1.0
Injection-Date: Tue, 26 Apr 2022 19:17:10 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 28