Windows XP search help

So I have many thousands of files and I want to make sure that each word in each file name starts with a capital letter. I know I once was able to search * a* (note the space before the a in the midst of the wild cards and every lowercase a preceded by a space was found. But now I can’t get it to work, it simply brings up all instances of the letter a. What did I do differently that one time to get it to work?

I am not sure if i understand you correctly. But i would recommend that you get GoogleDesktopSearch.

I want to find all files with a lower case ‘a’ which have a space immediately before it.

I did it before but now I can’t get it to work.

I don’t think you need the wildcards, because they are implied. I.e. in the “A word or phrase in the file:” box just put <space>a.

Now it’s working. Thank you Usram. I kept putting things in “All or part of a file name” and it didn’t work.

Related: Is it possible to do a search and replace on file names in a given folder? Say I had a bunch of files with underscores, and I wanted to convert them to spaces. Possible?

If you’re looking for an “easy” way (i.e. something built-in to the Windows GUI), I don’t think so.

I imagine you could do this with a batch file, or with Windows Script Host (whether that’s still included in XP, I’m not sure). Since my Windows batch file programming days are long behind me, I’ll leave it up to someone else to give you any further direction.

If you’re going to go the scripting route, and you don’t already know how to do it with DOS/cmd.exe, I think your best bet would be Python.

Seconded. While it’s sometimes possible to do this sort of thing with .bat files it can involve extraordinary batch file gymanstics. Anything other than simple renaming is very difficult in the standard Windows shell. True scripting languages such as Python, Perl or VBscript make it much more straightforward.

Paste the script below into a text file with a .cmd extension. Customize the value of the folder variable with the folder containing the files you want to rename. Double-clicking the script will rename the files.


@echo off
setlocal

set folder=c:\files

for /F "tokens=* usebackq" %%G in (`dir "%folder%" /A:-D /B`) do call :_process "%%G"
goto :eof

:_process
set newname=%~1
set newname=%newname:_= %
ren "%folder%\%~1" "%newname%"
goto :eof

Fantastic! Thanks so much!

Wow, I didn’t know that set could do search & replace. That’s actually pretty straightforward. I still say that the for command is a comprehensibility nightmare, though.

It may be ugly but it is incredibly useful in batch scripting.

Some handy references:
FOR /F
Variable Search
Parameters
SET