Windows – How to easily find files with no extension using Windows

cmd.exefile extensionpowershellsearchwindows-explorer

I have some files on my Hard Disk Drive that have no extensions whatsoever. It is very hard to find them manually, I really don't like the fact that I would need to replace my mouse sooner because of the not vast, but yet very prominent damage, done to the hardware from trying to find those files by constantly clicking and scrolling, since they are a few hundred files out of thousands in a single folder.

Does anyone here know of a cmd or PowerShell command, or some Windows Explorer search advanced query syntax to help simplify this task?

Best Answer

Finding Files with No File Extensions with Windows

Windows Explorer - Advanced Query Syntax

As per PetSerAl here are some of the File Explorer Advanced Query Syntax method to start with but read further down for the equivalent Command Line and Batch Script methods for this task.

Recursive Search

kind:= -folder type:= -[] extension:= []

Non-Recursive

Just select the "Current Folder" option thru the GUI "Search" tab

enter image description here

or

kind:= -folder type:= -[] extension:= [] folder:"C:\folder\path"

You can use a for /f loop iterating the output of a dir command with the /B and /A-D parameters, and then use some conditional if logic to only output files without any extensions using substitutions for the iterated files in the specified directory.

Command Line

Note: This assumes the directory you are in on the command line is the directory you are needing to search to display the files without extensions.

FOR /F "TOKENS=*" %A IN ('dir /B * /A-D') DO IF /I [%~nxA]==[%~nA] ECHO %~A

Batch Script

Note: This is a batch script that you set the SET Src= value to be the directory which you need to search to display files without extensions.

@ECHO ON
SET Src=C:\folder\path
FOR /F "TOKENS=*" %%A IN ('DIR /B "%Src%\*" /A-D') DO IF /I [%%~nxA]==[%%~nA] ECHO %%~A
PAUSE
EXIT

Further Resources

  • For /F
  • FOR /?

    In addition, substitution of FOR variable references has been enhanced. You can now use the following optional syntax:

    %~nI        - expands %I to a file name only
    %~xI        - expands %I to a file extension only
    
  • Dir

  • If
Related Question