Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.
dir/a-d/b/s "c:\test"|find/c /v""
the code fragment to get the count of files in a folder:Code: [Select]dir/a-d/b/s "c:\test"|find/c /v""
He's playing a game called IRL. Great graphics, *censored* gameplay.
Number of files stored in a particular folder ?
@echo offdir *.txt | wc -l
Number of files stored in a particular folder?
I have this .bat script
Dir /b FOLDERNAME>dir.txtfor /f %%a in (dir.txt) do set /a count+=1echo Number of files in the folder is %count%. Pause > nul
Dir /b particular_Folder>dir_p_f.txtfor /f %%a in (dir_p_f.txt) do set /a count+=1if %count%==0 ( echo.>> FolderCounter.log No files found in the specified foldermove FolderCounter.log Dir1)for /L %%b in (1 1 %count%) do call test.bat %%becho.>> FolderCounter.log %count% files werre loadedmove FolderCounter.log Dir1
(1,1,%count%) vs. (1 1 %count%)
Can you please tell me the difference
and what about the IF condition inside the FOR loop, ... am I coding it the right way?
It isn't inside a loop.
I just want my batch to test if %count%==0, and if true, just generate a .log file to explain this, and after it, exit (suspend execution)
dir /b /a-d particular_Folder>dir_p_f.txtfor /f %%a in (dir_p_f.txt) do (set /a count+=1)if %count%==0 (echo.>> FolderCounter.log No files found in the specified foldermove FolderCounter.log Dir1) else (for /L %%b in (1 1 %count%) do call test.bat %%becho.>> FolderCounter.log %count% files werre loadedmove FolderCounter.log Dir1)
dir /b /a-d particular_Folder>dir_p_f.txtset count=0for /f %%a in (dir_p_f.txt) do (set /a count+=1)if %count% EQU 0 ( echo No files found in the specified folder>>FolderCounter.log) else ( for /L %%b in (1 1 %count%) do call test.bat %%b echo %count% files were loaded>>FolderCounter.log)move FolderCounter.log Dir1