| Author |
Message |
Jesse Gardner
Guest
|
Posted:
Wed Sep 22, 2004 2:55 am Post subject:
Too many files in one directory... |
|
|
Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!! |
|
| Back to top |
|
 |
Jerold Schulman
Guest
|
Posted:
Wed Sep 22, 2004 5:08 pm Post subject:
Re: Too many files in one directory... |
|
|
On Tue, 21 Sep 2004 16:55:25 -0600, Jesse Gardner <ih8spam@badcrc.com> wrote:
| Quote: | Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!!
|
Roll your own.
ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1 [Folder2 Tolerance2 ...]
ExcessivelyLargeNumberOfFile.bat contains:
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %folder%^|Find " File"^|Find " bytes"') do (
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %folder% %num%
goto loop
:finish
endlocal
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com |
|
| Back to top |
|
 |
Jesse Gardner
Guest
|
Posted:
Wed Sep 22, 2004 6:52 pm Post subject:
Re: Too many files in one directory... |
|
|
Jerold Schulman wrote:
| Quote: | On Tue, 21 Sep 2004 16:55:25 -0600, Jesse Gardner <ih8spam@badcrc.com> wrote:
Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!!
Roll your own.
ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1 [Folder2 Tolerance2 ...]
ExcessivelyLargeNumberOfFile.bat contains:
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %folder%^|Find " File"^|Find " bytes"') do (
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %folder% %num%
goto loop
:finish
endlocal
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
|
That is awesome! Is there a way to make it search subdirectories as well?
-Jesse |
|
| Back to top |
|
 |
Jerold Schulman
Guest
|
Posted:
Thu Sep 23, 2004 5:48 pm Post subject:
Re: Re: Too many files in one directory... |
|
|
On Wed, 22 Sep 2004 08:52:02 -0600, Jesse Gardner <ih8spam@badcrc.com> wrote:
| Quote: | Jerold Schulman wrote:
On Tue, 21 Sep 2004 16:55:25 -0600, Jesse Gardner <ih8spam@badcrc.com> wrote:
Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!!
Roll your own.
ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1 [Folder2 Tolerance2 ...]
ExcessivelyLargeNumberOfFile.bat contains:
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %folder%^|Find " File"^|Find " bytes"') do (
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %folder% %num%
goto loop
:finish
endlocal
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
That is awesome! Is there a way to make it search subdirectories as well?
-Jesse
|
Yes.
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
setlocal ENABLEDELAYEDEXPANSION
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set /a num=0
set subf=%folder%
call :testsub
for /f "Tokens=*" %%a in ('dir %folder% /b /ad /s') do (
set subf="%%a"
call :testsub
)
:finish
endlocal
goto :EOF
:testsub
for /f "Tokens=1-4" %%a in ('dir %subf% ^|Find " File"^|Find " bytes"') do (
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %subf% %num%
goto loop
:finish
endlocal
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com |
|
| Back to top |
|
 |
Jerold Schulman
Guest
|
Posted:
Thu Sep 23, 2004 5:56 pm Post subject:
Re: Re: Too many files in one directory... |
|
|
Minor correction.
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
setlocal
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set subf=%folder%
call :testsub
for /f "Tokens=*" %%a in ('dir %folder% /b /ad /s') do (
set subf="%%a"
call :testsub
)
:finish
endlocal
goto :EOF
:testsub
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %subf% ^|Find " File"^|Find " bytes"') do (
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %subf% %num%
goto loop
:finish
endlocal
On Wed, 22 Sep 2004 08:52:02 -0600, Jesse Gardner <ih8spam@badcrc.com> wrote:
| Quote: | Jerold Schulman wrote:
On Tue, 21 Sep 2004 16:55:25 -0600, Jesse Gardner <ih8spam@badcrc.com> wrote:
Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!!
Roll your own.
ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1 [Folder2 Tolerance2 ...]
ExcessivelyLargeNumberOfFile.bat contains:
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFile.bat Folder1 Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %folder%^|Find " File"^|Find " bytes"') do (
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %folder% %num%
goto loop
:finish
endlocal
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
That is awesome! Is there a way to make it search subdirectories as well?
-Jesse
|
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com |
|
| Back to top |
|
 |
Jerold Schulman
Guest
|
Posted:
Thu Sep 23, 2004 6:57 pm Post subject:
Re: Too many files in one directory... |
|
|
Really Rerally Final version:
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFiles.bat Folder1 Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
setlocal
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set subf=%folder%
call :testsub
for /f "Tokens=*" %%a in ('dir %folder% /b /ad /s') do (
set subf="%%a"
call :testsub
)
goto loop
:finish
endlocal
goto :EOF
:testsub
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %subf% ^|Find " File"^|Find " bytes"') do (
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %subf% %num%
goto :EOF
:finish
endlocal
On Tue, 21 Sep 2004 16:55:25 -0600, Jesse Gardner <ih8spam@badcrc.com> wrote:
| Quote: | Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!!
|
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com |
|
| Back to top |
|
 |
Jesse Gardner
Guest
|
Posted:
Thu Sep 23, 2004 10:17 pm Post subject:
Re: Too many files in one directory... |
|
|
Jerold Schulman wrote:
| Quote: | Really Rerally Final version:
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFiles.bat Folder1 Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
setlocal
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set subf=%folder%
call :testsub
for /f "Tokens=*" %%a in ('dir %folder% /b /ad /s') do (
set subf="%%a"
call :testsub
)
goto loop
:finish
endlocal
goto :EOF
:testsub
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %subf% ^|Find " File"^|Find " bytes"') do (
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %subf% %num%
goto :EOF
:finish
endlocal
On Tue, 21 Sep 2004 16:55:25 -0600, Jesse Gardner <ih8spam@badcrc.com> wrote:
Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!!
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
|
Thanks for your continued help on this!!! I have a couple questions...
I ported the output to a file... (via the switch >test.txt) And that
seemed to work well, but I'm curious, why does it occasionally display
"File Not Found" and "Invalid number. Numbers are limited to 32-bits of
precision." in the console window?
More importantly, I want to make sure that it doesn't miss any
directories when it displays those errors. Maybe you know why it is
saying those messages? Thanks!
-Jesse
P.S. I don't know if this is too much to ask, but is there a way to
make this .bat file tell if there are too many directories in a
directory as well as files? Or is there a way to make a second .bat
that will tell me of too many directories? (I'm just curious) Thanks
again!!! |
|
| Back to top |
|
 |
Pat [MSFT]
Guest
|
Posted:
Sat Sep 25, 2004 12:16 am Post subject:
Re: Too many files in one directory... |
|
|
I would also suggest making sure that the the create 8.3 name is disabled
(you may want to test that this doesn't break some app compatibility). This
is a very common cause of perf problems in folders with a large number of
files (esp. if the files have similar names).
http://support.microsoft.com/default.aspx?scid=kb;en-us;121007
Pat
"Jerold Schulman" <Jerry@jsiinc.com> wrote in message
news:12p5l0h8ivdi44i0dm1bb68lji40v8lvd9@4ax.com...
| Quote: | Really Rerally Final version:
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFiles.bat Folder1
Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
setlocal
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set subf=%folder%
call :testsub
for /f "Tokens=*" %%a in ('dir %folder% /b /ad /s') do (
set subf="%%a"
call :testsub
)
goto loop
:finish
endlocal
goto :EOF
:testsub
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %subf% ^|Find " File"^|Find " bytes"') do
(
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %subf% %num%
goto :EOF
:finish
endlocal
On Tue, 21 Sep 2004 16:55:25 -0600, Jesse Gardner <ih8spam@badcrc.com
wrote:
Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!!
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com |
|
|
| Back to top |
|
 |
Jesse Gardner
Guest
|
Posted:
Sat Sep 25, 2004 1:24 am Post subject:
Re: Too many files in one directory... |
|
|
Thanks, I was actually planning on doing that. I'm just waiting to hear
back from our developers to make sure they don't have any legacy
software that would be affected.
Thank you for your help!
-Jesse
Pat [MSFT] wrote:
| Quote: | I would also suggest making sure that the the create 8.3 name is disabled
(you may want to test that this doesn't break some app compatibility). This
is a very common cause of perf problems in folders with a large number of
files (esp. if the files have similar names).
http://support.microsoft.com/default.aspx?scid=kb;en-us;121007
Pat
"Jerold Schulman" <Jerry@jsiinc.com> wrote in message
news:12p5l0h8ivdi44i0dm1bb68lji40v8lvd9@4ax.com...
Really Rerally Final version:
@echo off
if {%2}=={} @echo Syntax: ExcessivelyLargeNumberOfFiles.bat Folder1
Tolerance1
[Folder2 Tolerance2 ...]&goto :EOF
setlocal
:loop
if {%1}=={} goto finish
set folder=%1
set /a tol=1000000%2%%1000000
shift
shift
if not exist %folder% @echo Folder %folder% does NOT exist.&goto :loop
set subf=%folder%
call :testsub
for /f "Tokens=*" %%a in ('dir %folder% /b /ad /s') do (
set subf="%%a"
call :testsub
)
goto loop
:finish
endlocal
goto :EOF
:testsub
set /a num=0
for /f "Tokens=1-4" %%a in ('dir %subf% ^|Find " File"^|Find " bytes"') do
(
set /a num=1000000%%a%%1000000
)
if %num% LEQ %tol% goto loop
@echo %subf% %num%
goto :EOF
:finish
endlocal
On Tue, 21 Sep 2004 16:55:25 -0600, Jesse Gardner <ih8spam@badcrc.com
wrote:
Here at work we have a recurring problem where our programmers have
horrible file structure maintenance... (ie, we will get complaints
about slowness and after troubleshooting everything under the sun, we
will find a folder with >40,000 files in it. After cleaning it up
things run smoothly again.)
Do any of you know of a program or utility that will help you to search
for excessively large numbers of files in a directory? (like xtree or
ztree --Preferrably something better/gui)
TIA!!!
Jerold Schulman
Windows: General MVP
JSI, Inc.
http://www.jsiinc.com
|
|
|
| Back to top |
|
 |
|
|
|
|