Open Question: Question about “for” loop in batch?
batch scripting question. I am trying to use a FOR loop to receive a list of every file names in a directory. I want to then output them to a file. What I have currently is: for /r “public” %%g in (*) do echo ^ %%~nxg ^^^ >> public\index.html for each file within the sub-folder of the one from which the batch script is run… echo (etc.) to the file index.html in the public folder, which again, is a sub-folder of the one from which this script is run. What I would LIKE to do… is to have the exact same list but with a path, RELATIVE to the current path. In other words, if I have a file in “public” called “pickles.txt” I want it to JUST echo “pickles.txt”. However, if there is a FOLDER called “hello” which CONTAINS a FILE called “pickles.txt”, I want it to ECHO “hello\pickles.txt”. I know exactly what I want to do, I just don’t know how. I want to look in public\ and receive a list of files… then into each sub-directory, and receive a list of files, and their corresponding sub-direct