I have a Windows batch file that processes all files in a given directory. I need to process 206 783 files:
for %%f in (*.xml) do call :PROCESS %%f goto :STOP :PROCESS :: do something with the file program.exe %1 > %1.new set /a COUNTER=%COUNTER%+1 goto :EOF :STOP @echo %COUNTER% files processed
When I run the batch file, the following output is written:
Processed 65535 files
As part of the processing, an output file is created for each processed file with the extension .new . When I do dir *.new , it reports that there are 65,535 files.
So, it looks like my command environment has a hard limit on the number of files that it can recognize, and this limitation is 64 KB - 1.
- Is there a way to expand the command environment to manage more than 64K - 1 files?
- If not, can VBScript or JavaScript handle all 206,783 files?
I work on a Windows 2003 server, Enterprise Edition, 32-bit.
UPDATE
It seems that the main cause of my problem was the built-in βextractβ Windows command for ZIP files.
The files that I have to process were copied from another system via a ZIP file. There is no ZIP utility installed on my server, but only native Windows commands. I right-clicked the ZIP file and did "Extract All ...", which apparently just extracted the first 65,535 files.
I downloaded and installed 7-zip on my server, unpacked all the files, and my batch of script worked as intended.
source share