开发者

How can I tell if a file has the Windows "hidden bit" in Emacs?

开发者 https://www.devze.com 2022-12-14 02:38 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消