How to list all files (order by name) in a Linux directory/subdir, and then export result to a txt file?
Help me please!!! Thanks
How to list all files (order by name) in a Linux directory/subdir, and then
Share
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.
I’d use find as below
every regular file in /path/to/dir will have it’s absolute path printed out and uses bash redirection to /path/to/file
To have them sorted you would need to pipe through sort.
this will sort by full path to sort by basename
this will print the basename of the file first, sort on that then awk removes the initial filename and redirects just the absolute path into the file.