I need to write a script based on whether what I am reading is a file or directory. Basically I have a txt file which contains paths of files + directories, I am reading this file as follows: FOR /f %%i IN (root.txt) DO (call :output %%i)
I need to call :output which will output only the files contained in the txt file.
so if root.txt contains:
C:\TEST
C:\TEST\test.txt
C:\TEST\TEST2\test2.txt
The output should be:
C:\TEST\test.txt
C:\TEST\TEST2\test2.txt
See this SuperUser question to find out how to test if something is a directory.
You basically have to append
\to the end, and then useIf Exist; so your script becomes: