Solved Finding filenames containing double spaces.

beggersrun

New member
Local time
11:10 PM
Messages
4
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!

Thanks!

- Dale
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Lenovo G550
OS
Windows 7 32bit
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 Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Lenovo IdeaCenter 450
OS
Windows 10 Pro X64
CPU
Intel Quad Core i7-4770 @ 3.4Ghz
Memory
16.0GB PC3-12800 DDR3 SDRAM 1600 MHz
Graphics Card(s)
Intel Integrated HD Graphics
Sound Card
Realtek HD Audio
Monitor(s) Displays
HP 22" LCD
Screen Resolution
1680 x 1050
Hard Drives
250GB Samsung EVO SATA-3 SSD
2TB Seagate ST2000DM001 SATA-2
1.5TB Seagate ST3150041AS SATA
Keyboard
Dell USB
Mouse
Lenovo USB
Internet Speed
Cable via Road Runner 3MB Upload, 30MB Download
Antivirus
Windows Defender, MBAM Pro, MBAE
Browser
Seamonkey
Other Info
UEFI/GPT
PLDS DVD-RW DH16AERSH
Thank you for your reply. Will this also search any subfolders? There are literally thousands.

edit

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

/edit
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Lenovo G550
OS
Windows 7 32bit
Code:
dir *"  "* [B][COLOR=Red]/s[/COLOR][/B] > 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 Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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 Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Lenovo G550
OS
Windows 7 32bit
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.

Code:
dir *"  "* /s /b > file.txt
 

My Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Employer provided Dell Latitude
OS
W7 Pro SP1 64bit
CPU
i7
Memory
8GB
Graphics Card(s)
Intel HD Graphics
Hard Drives
crappy SSD
Antivirus
Employer mandated Symantec Endpoint Protection
Browser
Pale Moon 64bit, IE11 64bit & Chrome 64bit
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 Computer My Computer

Computer type
Laptop
Computer Manufacturer/Model Number
Lenovo G550
OS
Windows 7 32bit

My Computer My Computer

Computer type
PC/Desktop
Computer Manufacturer/Model Number
Self Built Custom
OS
Windows 7 Ultimate Retail Box (64-bit installed) + Service Pack 1
CPU
AMD FX-8350 CPU v1.15 (or 1.0F) BIOS was required!
Motherboard
MSI 890FXA-GD70
Memory
8G CAS-7 G-Skill DDR3 @1333 (2 fours) [mobo nonOC max rec'd]
Graphics Card(s)
Radeon HD 7950 [3 gigs of GDDR5] MSI Twin Frozr model
Sound Card
Realtek High Definition Audio (onboard mobo, ALC-889 chip)
Monitor(s) Displays
2 WS LED Monitors: One LG One Viewsonic
Screen Resolution
1920 by 1080
Hard Drives
SSD for OS: Samsung 840 Pro
SSD for VM and utilities: Adata SX900
7200 RPM SATA HDs for the rest: Hitachi and Seagate
PSU
Corsair TX850 - 850W max, in service since August 2010.
Case
Thermaltake Armor A90
Cooling
Thermaltake Spin Q CPU Cooler, in service since August 2010
Keyboard
Logitech G11
Mouse
Logitech M310 Wireless
Internet Speed
100 Megabit broadband supposedly upgraded from 50 (Cable)
Antivirus
Bitdefender Internet Security 2014 suite
Browser
Pale Moon 64-bit main, also IceDragon, Opera, and Maxthon.
Other Info
CompTIA A+ certified (220-800 series) in July 2013.
Back
Top