-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add omit_hidden
option to readdir
?
#38841
Comments
Define hidden file... |
True, I have no idea how hidden files work on Windows. I'm not a Windows user... |
Well, define hidden on macOS then... There's at least two or three notions of this on macOS. |
One could define "hidden" as "does not appear in default directory listings in the standard file-picker interface for that OS", I suppose. On Windows, one could use GetFileAttributesW and check whether the file has Presumably one could implement something to check for hidden files on MacOS as well. How useful would a filesystem-specific |
I think that would be the first step. It could just check for leading dot in the name for Linux; for macOS it would check that plus the three other kinds of hiddenness; for Windows the GetFileAttributesW thing. There are some additional considerations: is a path hidden if some prefix of it is hidden? Or only if the last component is hidden? |
This would be great for UI applications written in Julia :) It looks like Python 3.5 started including the output of (I also found that Python and NodeJS do not have "hidden file" in their stdlib, perhaps because it is not as well-defined outside of windows) |
Thanks for raising this issue @CameronBieganek . I agree that this functionality would be useful, although it needn't necessarily be in Base. As such, I've begun work on a library (HiddenFiles.jl) to hide away all of the nastiness/nuance of hidden files on different systems. It's very much a work in progress, but it's getting there. Still need to register the package, but will do that after I make proper tests/CI/documentation, and finish implementing a solution for BSD. @StefanKarpinski, you mentioned there are three things to check after checking for a leading Also, is there a consensus on your earlier question?:
|
See this link for macOS hidden files. |
Thanks @stevengj, I saw that link from your previous comment, however it felt very high-level. If that's the best that there is then I can probably work from that, thank you. |
I couldn't find an issue for this. I was expecting there to be an optional keyword argument for
readdir
to omit hidden files and directories. Currently I'm doing thiswhich works for hidden files but not for hidden directories. It seems like it would be handy to have an
omit_hidden
or similar option forreaddir
.I encountered this because of the pesky
.DS_Store
files on MacOS. 😂The text was updated successfully, but these errors were encountered: