I am trying to export a list of specific file extensions from different folder paths. My code is not working somehow.
@Echo on
SetLocal EnableExtensions DisableDelayedExpansion
Set "SourceDir=C:\Users\Murray\Documents\Mainfile"
Set "Ext1=.ssl"
Set "Ext2=.conf"
for /f "delims=" %%A in ('Dir /B /A:-D "%SourceDir% ^| findstr /ie "%Ext1%" ^|
%SystemRoot%\System32\findstr.exe /ie "%Ext2%" ') do echo %%A >> C:\Users\Murray\Documents\log.txt
Pause
What I want to overcome is to list all files from different directories and selected file extensions with full path. I would like to do this by setting variables. It is very likely that I am missing a few point. My main goal is to get full paths from a log text then copy them to the several directories depending on their extensions (Destination paths will be several and I will set them as variable similar to the listed code above not to use multiple goto
submenus). Thanks in advance.
@Echo on
SetLocal EnableExtensions DisableDelayedExpansion
Set "SourceDir=C:\Users\Murray\Documents\Mainfile"
Set "Ext1=.ssl"
Set "Ext2=.conf"
for /f "delims=" %%A in ('Dir /B /A:-D "%SourceDir%" ^| findstr /ie "%Ext1%" ') do echo %%A >> C:\Users\Murray\Documents\log.txt
Pause
This code exports the list of all files with extension .ssl
to the log.txt from %SourceDir%
but I could not manage to add extensions which were defined with %Ext2%
so that they can be listed in the same log.txt file. Actually, The real problem here I would like to learn is that how can I set multiple source variables (different folder paths and file extension) as in my example to my code? For instance, how can I use multiple variables with Findstr
?