0

This is my first time here. I used the site to find answers to my questions anonymously many times before.

A very similar question already exists here, but it didn't help me with my problem.

In my batch file, I set a variable to pass to robocopy the files to exclude:

SET EXCL=*.bak *.inp_bak *.dwl *.err plot.log dotlog.txt logs\*.log

EDIT: I want to list and confirm all files to be excluded first.

The problem is in the last part, "logs\*.log", i.e. I am looking for .log files in a subfolder "logs" under the current folder.

In a command prompt window, I can execute this command without problems:

dir %EXCL% /b /s

and %ERRORLEVEL% returns 0. However, in my .bat I have this same line but %ERRORLEVEL% returns 1, and I noticed that DIR shows me all the files but when it gets to the "logs\*.log" part I get the message "File not found".

What I am trying to do is list any "plot.log" files in the current folder or any subfolder (/s) + all the .logs in the specified subfolder, but NOT other .log files in other subfolders.

Is it possible to do this on a single line within the batch file? I don't want to run two different DIRs

0 Answers0