Skip to content

Instantly share code, notes, and snippets.

@okplanbo
Last active May 1, 2024 13:05
Show Gist options
  • Save okplanbo/c1c99485bd3971c60ec1becce6a1eb23 to your computer and use it in GitHub Desktop.
Save okplanbo/c1c99485bd3971c60ec1becce6a1eb23 to your computer and use it in GitHub Desktop.
Win script for making file list. Recursively searches non-hidden, non-sys files in a current folder and makes a list of them with paths in txt format
@echo off
setlocal enabledelayedexpansion
set "outputFile=files_list.txt"
:: Change the code page to UTF-8 to handle Cyrillic characters
chcp 65001
if exist "%outputFile%" (
del "%outputFile%"
)
echo Processing files, please wait...
set /a processedFiles=0
set /a displayCounter=0
for /r %%i in (*) do (
attrib "%%i" | find "SH" >nul || (
echo %%i >> "%outputFile%"
set /a processedFiles+=1
set /a displayCounter+=1
if !displayCounter! geq 10 (
cls
echo Processing files, please wait...
echo Files processed: !processedFiles!
set displayCounter=0
)
)
)
cls
echo Processing files, please wait...
echo Files processed: %processedFiles%
echo File list generated in %outputFile%.
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment