Using Windows Explorer, how to find file names starting with a dot (period), in 7 or Vista?

14

2

I've got a MacBook laptop in the house, and when Mac OS X copies files over the network, it often brings along hidden "dot-files" with it. For instance, if I copy "SomeUtility.zip", there will also be copied a hidden ".SomeUtility.zip" file. I consider these OS X dot-files as useless turds of data as far as the rest of my network is concerned, and don't want to leave them on my Windows file server.

Let's assume these dot-files will continue to happen. i.e. Think of the issue of getting OS X to stop creating those files, in the first place, to be another question altogether.

Rather: How can I use Windows Explorer to find files that begin with a dot / period? I'd like to periodically search my file server and blow them away. I tried searching for files matching ".*" but that yielded – and not unexpectedly – all files and folders.

Is there a way to enter more specific search criteria when searching in Windows Explorer? I'm referring to the search box that appears in the upper-right corner of an Explorer window. Please tell me there is a way to escape my query to do what I want?

(Failing that, I know I can map a drive letter and drop into a cygwin prompt and use the UNIX 'find' command, but I'd prefer a shiny easy way.)

Chris W. Rea

Posted 2010-04-18T15:44:34.073

Reputation: 10 282

1i thought cygwin was the shiny easy way! :) – quack quixote – 2010-04-18T15:50:06.293

Answers

17

Use Window's "Search Advanced Query Syntax", which basically lets you do stuff that Vista and XP advanced search used to let you (that Windows 7 hid). Read about it on MSDN.

Hence, you can just search filename:. to find all files with a file name that begins with "."

Vervious

Posted 2010-04-18T15:44:34.073

Reputation: 4 654

thanks, I have an icon library from all the free downloads i encounter. Have just deleted 25k files starting with . – Valamas – 2011-10-12T23:18:20.613

The link seems to be (effectively) broken (it redirects to http://windows.microsoft.com/en-US/windows/downloads/windows-xp).

– Peter Mortensen – 2012-04-06T14:35:44.270

@PeterMortensen fixed! – Vervious – 2012-04-06T17:14:10.380

6

The windows Command prompt method to find all "dot files" in all directories below the current directory, but excluding directory names beginning with dot:

dir .*.* /s /a-D

Mike

Posted 2010-04-18T15:44:34.073

Reputation: 1 062

1+1 for not resorting to 3rd party programs, although I think you mean "including directories below", as that's what /s does – RJFalconer – 2010-04-18T16:29:37.593

dir \.* only returns .rnd (what this is, I don't know). If you want to see the files that start with a ., you need to use dir .*.*. – raven – 2010-04-18T16:58:55.060

To clarify - the /s searches all subdirectories, but the /a-D excludes directory names beginning with dot. I'll edit the answer to make it clearer. – Mike – 2010-04-19T01:39:53.600

3

filename:.*. -kind:folder

This finds all files which begin with a period, even those which do not have an extension. -kind:folder excludes folders from the search. Tested on Windows 7. Should work on Vista and Windows 8.

Quaixor

Posted 2010-04-18T15:44:34.073

Reputation: 31

1

If you're willing to use a free 3rd party application, I highly suggest Locate32. You can search using regular expressions.

:^\. finds the files you are looking for. (You could also opt to exclude directories from results.) As a bonus, Locate32's index and search is much faster than the built-in Windows search. Plus the right-click context menu gives you some extra options like "Copy path to clipboard" and "Compute MD5."

I've created an AHK script so I can quickly bring up Locate32 with Win-F3.

Leftium

Posted 2010-04-18T15:44:34.073

Reputation: 8 163

Great suggestion, just used this to find files matching ".-" without needing to use a regex. Also once files are found you can do the normal right-click operations e.g. delete. – RichVel – 2015-06-10T15:20:50.627

Your image is broken. Do you happen to have the original that you could reupload? Thanks. – Gaff – 2011-09-29T05:04:17.513

@Gareth: Dude, are you like some type of robot? I couldn't find the original image... – Leftium – 2011-09-29T15:33:27.320

1

You can stop the Mac creating the .DS_Store files with this command in Terminal:

defaults write com.apple.desktopservices DSDontWriteNetworkStores true

Then log out and in again (or reboot). That should fix it. As for the other files, this is a well-known problem and I haven't been able to find a quick answer.

mauvedeity

Posted 2010-04-18T15:44:34.073

Reputation: 745

1

There are not one, not two, but three tags on this post mentioning windows and yet you provide a mac solution.

– Eddie B – 2012-11-27T20:20:56.810

1

Late addition ... I'm adding this as it comes in quite handy to set attributes from the command line for dot files (or directories) ...

The first dot is to search the current directory; the second is 'back-slashed escaped' to search for names starting with a dot literal.

dir ".\.*" /A 

Eddie B

Posted 2010-04-18T15:44:34.073

Reputation: 909

The back slash is not a 'back-slashed escape' character. Rather it is a path separator which separates the first period, which is the path, from the second period, which is the initial part of the file name. – Itsme2003 – 2019-01-19T17:16:20.573

0

To add to an earlier answer:

dir .*.* /s /a-D

This will also work:

dir .* /s /a-D

The difference being when you drop the trailing ".*" from the command, this finds files with or without an extension (i.e. the second dot before the extension).

Tested in Windows 7 & 10 using both commands produced the same results in my case because all files had extensions.


Note

When dealing with Mac resource forks you may want to narrow your search to files staring with "._"

dir ._*.* /s /a-D or dir ._* /s /a-D

That way "dot files" you want to keep like ".htaccess" and ".htpasswd" are excluded.

Jay

Posted 2010-04-18T15:44:34.073

Reputation: 11

0

In Windows XP I was able to use Windows Explorer to search for .?* to see all files and folders that begin with a dot. Perhaps it works the same in Windows Vista and Windows 7.

Be careful, for me this returned files and folders, files and folders inside zip files, files and folders as seen in the Explorer Recycle Bin, and files and folders as seen in the Command Prompt RECYCLER folder. The search will likely also find files and folders as seen in other special folder views Explorer has.

Bavi_H

Posted 2010-04-18T15:44:34.073

Reputation: 6 137

Thanks for the suggestion, but I just tried this and it also seems to return all files and folders in Windows 7, not just those beginning with a period. – Chris W. Rea – 2010-04-18T19:59:56.773