How do I get Dir['*']
to include dotfiles, e.g., .gitignore
, but not .
and ..
?
I.e., is there a better way to do:
`ls -A`.split "\n"
perhaps with Dir
? The following solutions are close but both include .
& ..
:
Dir.glob('*', File::FNM_DOTMATCH)
Dir['{.*,*}']
So, the following works:
Dir.glob('*', File::FNM_DOTMATCH) - ['.', '..']
But, is there still a better way to do this?
I'm wondering this to fix line 9 of a Meteor Homebrew Formula.
:P
– RanjivDir.glob(“{*,.*}”)
? – Gambrell.
&..
entries. – Immortalizels -A
excludes.
&..
on OS X. Perhaps, you're thinking ofls -a
? – Immortalizels
aliased tols -aFh
and didn't do\ls -A
…whoops. Realized it after the fact though and deleted the (wrong) comment. – Ranjiv