Finding filenames containing double spaces.


  1. Posts : 4
    Windows 7 32bit
       #1

    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!

    Thanks!

    - Dale
      My Computer


  2. Posts : 6,285
    Windows 10 Pro X64
       #2

    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


  3. Posts : 4
    Windows 7 32bit
    Thread Starter
       #3

    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


  4. Posts : 10,485
    W7 Pro SP1 64bit
       #4

    Code:
    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 Computer


  5. Posts : 4
    Windows 7 32bit
    Thread Starter
       #5

    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


  6. Posts : 10,485
    W7 Pro SP1 64bit
       #6

    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


  7. Posts : 4
    Windows 7 32bit
    Thread Starter
       #7

    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


  8. Posts : 1,269
    Windows 7 Ultimate Retail Box (64-bit installed) + Service Pack 1
       #8

    Here's a freeware renaming tool that is excellent:

    Advanced Renamer - Free download

    Saved me a lot of headaches!
      My Computer


 

  Related Discussions
Our Sites
Site Links
About 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 19:09.
Find Us