Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
235 views
in Technique[技术] by (71.8m points)

How do I search for 2+ blank spaces in Windows 10 file explorer?

In the past, searching for files in windows 10 file explorer that had two or more spaces in the filename was easy: I'd just input "*bsbs*", two blank spaces between asterisks between quotes into the search filter (bs stands for a blank space, have to use 'bs' because stackoverflow doesn't seem to like adjacent blank spaces either). Now whenever I input "*bsbs*" into the search filter in file explorer, it reverts to "*bs*", a single space. Obviously, not what I want...

I don't understand why it functions like this now but it might have to do with an update implemented 11/2019: https://www.techrepublic.com/article/how-to-use-the-search-tool-in-windows-10-file-explorer/

Anyways, any help on searching for files with adjacent blank spaces in the file name? Thanks!


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Okay, I've put together something in Python to search directories/sub-directories for files/folders with 2+ spaces in it.

import os

kiriepath = "path goes here"

def twoplusspaces(path):

    srchr = os.scandir(path)

    for entry in srchr:
        if "  " in entry.name:
            print(entry.name)
        if entry.is_dir():
            twoplusspaces(path + "\" + entry.name)

    srchr.close()

twoplusspaces(kiriepath)

Was good practice! Leaving here in case it might help someone else.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...