How can I get all the files inside /var and its subdirectories but at the same time, ignoring list out subdirectory folder name?
I have tried Dir["/var/*"] but it doesn’t list all the files inside sub directory.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The
**that appears in this pattern matches any path fragment of zero or more nested directories, but doesn’t match files.Let’s break that down:
When you have
/var/somefile.txt(which likely doesn’t exist on your system, because/varmost likely only has directories in it), here’s what each part of your glob would match:For the file
/var/run/NetworkManager.pid:For the file
/var/spool/mail/news:I’m not sure what
Dir['/var/**']on its own does. I think that to make it work the way you expect, you always need another path component after the**.