Crypto pushd

Comment

Author: Admin | 2025-04-28

Forgive any blatant errors.I tried to write an all in one solution as best I can with a little modification where the user requires it.Some important notes: Just change the variable recursive to FALSE if you only want the root directories files and folders processed. Otherwise, it goes through all folders and files.C&C most welcome...@echo offtitle %~nx0chcp 65001 >NULset "dir=c:\users\%username%\desktop":::: Recursive Loop routine - First Written by Ste on - 2020.01.24 - Rev 1::setlocal EnableDelayedExpansionrem THIS IS A RECURSIVE SOLUTION [ALBEIT IF YOU CHANGE THE RECURSIVE TO FALSE, NO]rem By removing the /s switch from the first loop if you want to loop throughrem the base folder only.set recursive=TRUEif %recursive% equ TRUE ( set recursive=/s ) else ( set recursive= )endlocal & set recursive=%recursive%cd /d %dir%echo Directory %cd%for %%F in ("*") do (echo → %%F) %= Loop through the current directory. =%for /f "delims==" %%D in ('dir "%dir%" /ad /b %recursive%') do ( %= Loop through the sub-directories only if the recursive variable is TRUE. =% echo Directory %%D echo %recursive% | find "/s" >NUL 2>NUL && ( pushd %%D cd /d %%D for /f "delims==" %%F in ('dir "*" /b') do ( %= Then loop through each pushd' folder and work on the files and folders =% echo %%~aF | find /v "d" >NUL 2>NUL && ( %= This will weed out the directories by checking their attributes for the lack of 'd' with the /v switch therefore you can now work on the files only. =% rem You

Add Comment