Let's say I have folder A and Folder B. Folder A has files A1 and A2. Folder B has files B1 and B2.
I want to create a text file in each folder that list the files in that folder. So create fileA.txt in folder A that list filenames A1 and A2 and same for B
Tried the following but didn't work
for /d %%g in ("*") do (
for /r %%y in ("*.mp4") do (
echo file '%%y'
) > ./%%g/mylist.txt
)
Any help is appreciated
>>
to append to the file. A single>
overwrites previous content, so only the last write persists.for /d %%g in ("*") do (
for /r %%y in ("*.mp4") do (
echo file '%%y' >> ./%%g/mylist.txt
)
)