Windows 7 Forums
Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Finding filenames containing double spaces.

15 Apr 2013   #1

Windows 7 32bit
Finding filenames containing double spaces.

Greetings. Noob here. Please be gentle. I searched everywhere, but can't find answer.

I have 40,000+ filenames in 1 folder and subfolders of which 140 filenames contain double spaces. I would LIKE to find/use a script to find and rename these files to replace the double spaces to just one, but would be happy just to find and list these files where I can print the listing.

Using the standard search in explorer doesn't work ... even when placing the double spaces in quotes.

Any help would be appreciated!


- Dale

My System SpecsSystem Spec
15 Apr 2013   #2

Windows 10 Pro X64

Open a Elevated Command prompt.
Change to the drive and folder you want to work with.

For example: cd C:\Users\xxxxxxxx\Documents\Consulting

Type dir *" "* and press Enter. (there must be exactly two blank spaces between the double quotes)

That will list all the files with exactly two spaces in the name. If you want to create a list you can edit and work with, do this:

Type dir *" "* > 2blanks.txt and press Enter.
Type notepad 2blanks.txt and press Enter to edit the output list.
My System SpecsSystem Spec
15 Apr 2013   #3

Windows 7 32bit

Thank you for your reply. Will this also search any subfolders? There are literally thousands.


I just realized that was a dumb question. Brain isn't awake yet.
Is there a way to search subfolders as well?

My System SpecsSystem Spec

15 Apr 2013   #4

W7 Pro SP1 64bit

dir *"  "* /s > file.txt
Is this a one time thing or do you need to rename files like this very often?

Is there one folder with lots of sub folders one level down?
top folder\sub folder1
top folder\sub folder2
top folder\sub folder3
top folder\sub folder4

Or, are there several levels of folders?
top folder\sub folder1\sub folder too
top folder\sub folder2\sub folder too
top folder\sub folder3\sub folder too

Are these files at all levels of folders?
top folder\filename1
top folder\filename2
top folder\filename3
top folder\filename4
top folder\sub folder\filename5
top folder\sub folder\filename6
top folder\sub folder\filename7
top folder\sub folder\sub folder too\filename8
top folder\sub folder\sub folder too\filename9
My System SpecsSystem Spec
15 Apr 2013   #5

Windows 7 32bit

Hello. This is just a one-time thing. I found and fixed the program that was causing the issue.

Thank you. It appears that this is just what I needed!

- Dale
My System SpecsSystem Spec
15 Apr 2013   #6

W7 Pro SP1 64bit

Glad to hear it.

Once you are sure - please mark the thread as solved.

And for those that might run across this thread someday...
...the "/b" switch makes for a cleaner output.

dir *"  "* /s /b > file.txt
My System SpecsSystem Spec
15 Apr 2013   #7

Windows 7 32bit

I ran the command and it found and listed all 142 files of the 44,765 ... so it worked. To answer your question, there are several levels of folders.

Solved. Many thanks again!

Ran it again using the /b switch. PERFECT!
My System SpecsSystem Spec
16 Apr 2013   #8

Windows 7 Ultimate Retail Box (64-bit installed) + Service Pack 1

Here's a freeware renaming tool that is excellent:

Advanced Renamer - Free download

Saved me a lot of headaches!
My System SpecsSystem Spec

 Finding filenames containing double spaces.

Thread Tools

Similar help and support threads
Thread Forum
Finding something that responds to double mouse button 2 clicks
Normally, the left mouse button is mouse button #1 and the right button is button #2. When configured for left-handed use, the relationships are reversed. My left button sometimes generates two clicks, making it hard to change the status of a checkbox, or ordering two items in Amazon instead of...
General Discussion
Spaces in document 99--100
Can somebody help me out here Please,How do I solve the space between the double numbers & the 100 and the text in a word document. as per image. Windows 7 and office 2010. Many Thanks.
Microsoft Office
Drive Spaces
I have Windows 7 installed on my laptop. I have two drives one Drive C i.e. System Drive and other is Drive D. I have 320 GB Hard Drive. 60GB on Drive C and around 230GB on Drive D. I am facing a strange problem in my system. Drive C is almost 50GB filled with Windows, System Updates and...
Performance & Maintenance
Great computing/technology based double double meaning jokes?
One of my (real life :p) friends said in IRC to all of us that we should each buy a 3DS. I responded "I'd rather buy a Vita", "BAZINGA - double meaning ;P" (as as you probably all know, vita is latin for life, as well as the name of the PlayStation Vita, so it was the usual "I'd rather get a...
Chillout Room
Double Monitors = Double Desktop Headache!
I just got a new monitor, and I've always wondered what it would be like to have 2 monitors at once, seeing as my 16" has nothing wrong with it (aside from a scuff mark in the LCD when I dropped it on a screwdriver) Anyway, I got it setup, and it's amazing! I'd say it's increased my productivity...
General Discussion

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 03:39.
Twitter Facebook Google+