Anyone have an example I can use?
I need to search thru a bunch of folders and subfolders, and find any files/folders that have lowercase characters. I don't need to change them, just list them, or return an error code, or both.
Find all lowercase files in a sub directory
Moderator: DosItHelp
Re: Find all lowercase files in a sub directory
Simple using FINDSTR with the correct regular expression:
You cannot use [a-z] because of the reasons described at Why does findstr not handle case properly (in some circumstances)?
See What are the undocumented features and limitations of the Windows FINDSTR command? for an extensive list of FINDSTR oddities.
Dave Benham
Code: Select all
dir /b /s | findstr "[abcdefghijklmnopqrstuvwxyz][^\\]*$"
You cannot use [a-z] because of the reasons described at Why does findstr not handle case properly (in some circumstances)?
See What are the undocumented features and limitations of the Windows FINDSTR command? for an extensive list of FINDSTR oddities.
Dave Benham
Re: Find all lowercase files in a sub directory
Thanks!
That fit nicely, and the undocumented features allowed me to have some error handling.
Yes, the error is slightly backwards, because fail for me is when it finds a match.
That fit nicely, and the undocumented features allowed me to have some error handling.
Code: Select all
dir /b /s %EXTRACT% | findstr "[abcdefghijklmnopqrstuvwxyz][^\\]*$" >> %LOG%\%LOGFILE%
IF %ERRORLEVEL% NEQ 1 (
ECHO Lower Case File Found
ECHO Check log at %LOG%\%LOGFILE%
pause
GOTO:EOF
)
Yes, the error is slightly backwards, because fail for me is when it finds a match.
Re: Find all lowercase files in a sub directory
Good to know. I didn't know that the range option didn't work correctly with FINDSTR.