Last active
February 19, 2024 14:25
-
-
Save doneykoo/28b415acd78ad11104d05d47674cdeb0 to your computer and use it in GitHub Desktop.
traverse files recursively with certain extensions in windows folder, and unix2dos convert line endings to crlf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@echo off | |
setlocal | |
set "target_directory=%~1" | |
shift | |
set "extensions=%*" | |
if not defined target_directory ( | |
goto ShowUsage | |
) | |
if not defined extensions ( | |
goto ShowUsage | |
) | |
for %%e in (%extensions%) do ( | |
for /R "%target_directory%" %%f in (*.%%e) do ( | |
echo %%f | |
) | |
) | |
endlocal | |
exit /b 0 | |
:ShowUsage | |
echo Usage: %0 [path_to_directory] [file_extension1] [file_extension2] ... | |
echo Usage: %0 C:\your_folder txt jpg png | |
exit /b 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment