tags:

views:

104

answers:

1

I use Emacs on various platforms. When I use it on Windows, I don't want files with the "hidden attribute" to show on ido-find-file, dired, etc. I can't seem to find any function in Emacs that can tell me whether a file has the hidden bit or not (file-attributes doesn't seem to, from the help page).

Any ideas?

+2  A: 

There's no specific elisp function that will tell you whether or not a file's hidden attribute is set on Windows. However, you can write an elisp function that invokes the Windows attrib command and parses its output. For example, (shell-command-to-string "attrib c:\\foo.txt") would return a string like A HR c:\\foo.txt (in this particular example, the file has three attributes set: archive, read-only, and hidden). At that point, you just need to look for the H in the string that attrib returns to determine whether or not the file is hidden.

Emerick Rogul
This is what I was planning to do if there wasn't an elisp function. I didn't know about the "attrib" call, however - saves me from writing some Python script to do it. Thanks.
Christopher Monsanto
A search through Emacs' code shows nothing for hidden files, and `file-attributes` returns the same thing whether the hidden bit is on or off.
Trey Jackson