Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ::https://superuser.com/questions/1272715/how-to-search-and-find-all-the-files-with-particular-name-using-batch
- ::https://ss64.com/nt/ - An A-Z Index of the Windows CMD command line
- ::https://ss64.com/nt/commands.html - A categorized list of Windows CMD commands
- ::del - Delete one or more files.
- ::dir - Display a list of files and subfolders.
- ::endlocal - End localisation of environment changes in a batch file. Pass variables from one batch file to another.
- ::find - Search for a text string in a file & display all the lines where it is found.
- ::set - Display, set, or remove CMD environment variables. Changes made with SET will remain only for the duration of the current CMD session.
- ::setlocal - Set options to control the visibility of environment variables in a batch file.
- @echo off
- setlocal
- rem change to the correct directory
- cd /d d:\
- rem count the files
- dir /b new.txt /s 2> nul | find "" /v /c > %temp%\count
- set /p _count=<%temp%\count
- rem cleanup
- del %temp%\count
- rem output the number of files
- echo Files found : %_count%
- rem list the files
- echo Files Paths :
- dir /b new.txt /s
- endlocal
Add Comment
Please, Sign In to add comment