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 f开发者_JAVA百科unction 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?
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.
精彩评论