windows - Number of files in a directory -


i'm try find, in 1 row, number of files (*.rar) in directory.

for doing i'm using commands:

for /f "delims=" %i in ('find /c ".rar" "d:\backup e ckpdb ept-icd\test\unload\lista_files_rar.txt"') echo %i 

but value of %i have @ end : d:\backup e ckpdb ept-icd\test\unload\lista_files_rar.txt: 8

i obtain number 8 instead echo value assign value variable.

i use command line : dir /b *.rar | find /c ".rar" returns value of rar files in directory, can't assign value variable, example: dir /b *.rar | find /c ".rar" | set/a files =

i tried use keyword tokens=2 doesn't work

p.s if possible find command better

see here example on counting files

or can (not tested)

for /f %%j in ('dir /b *.rar ^| find /c /v ""') set count=%%j 

Comments

Popular posts from this blog

c++ - Convert big endian to little endian when reading from a binary file -

C#: Application without a window or taskbar item (background app) that can still use Console.WriteLine() -

unicode - Are email addresses allowed to contain non-alphanumeric characters? -