zelarra821
Registered User.
- Local time
- Today, 08:15
- Joined
- Jan 14, 2019
- Messages
- 840
Hi guys.
I'm having a problem with a bat file that I can't seem to solve, and it's driving me crazy.
I want to count the files in a folder and its subfolders, but without including a file type or the name of a specific file. This is where the problem lies: no matter how many filters I use, it doesn't give me the result I want.
The bat file code is as follows:
I don't want it to count files with a .sh extension initially, but I'd like to know if I want to include a specific file name along with a file type in the future, how would I do it?
Thank you very much.
I'm having a problem with a bat file that I can't seem to solve, and it's driving me crazy.
I want to count the files in a folder and its subfolders, but without including a file type or the name of a specific file. This is where the problem lies: no matter how many filters I use, it doesn't give me the result I want.
The bat file code is as follows:
Code:
@echo off
setlocal enabledelayedexpansion
set "FOLDER="%D:\Bandeja de entrada\000 M¢vil""
set "IGNORE_EXT=.sh"
echo.
dir !FOLDER!
for /f %%n in ('dir /b /a-d ^| findstr /v /i "!IGNORE_EXT!" ^| find /c /v ""') do (
set COUNT=%%n
if !COUNT! equ 0 (
echo.
echo No files.
@pause
exit /b
) else (
echo.
echo Files found.
@pause
exit /b
)
)
endlocal
I don't want it to count files with a .sh extension initially, but I'd like to know if I want to include a specific file name along with a file type in the future, how would I do it?
Thank you very much.