I want to search files with .log extension recursively in a directory. I am trying like below command in a batch file.
for /R %%A in (*.log) do echo %%A >> All_logs.txt
I tried this also:
for /R %%A in (*.log) do echo %%~nxA >> All_logs.txt
But I am either getting full path like this:
D:\Folder1\sub_folder1\bootmicro.log
D:\Folder1\sub_folder2\debug.log
or
bootmicro.log
debug.log
respectively.
Since I am running the batch file in the path D:\Folder1, I want search result to be like:
sub_folder1\bootmicro.log
sub_folder2\debug.log
Further, in the same batch file, I want to create folders using the resultant file names as below:
sub_folder1_bootmicro_log_Analysis
sub_folder2_debug_log_Analysis
or
sub_folder1_bootmicro.log_Analysis
sub_folder2_debug.log_Analysis
How can I do this all?