How to List only regular file names in a directory on Linux and Windows
Listing regular files in a directory without including . and .. files.
On Linux
Solution 1:$ ls -p | grep -v /
Solution 2: $ ls -F | grep -v ‘[/@=|]’
Solution 3: $for list in `ls` ; do ls -ld $list | grep -v ^d > /dev/null && echo $list ; done ;
Solution4:$ for list in `ls` ; do ls -ld $list | grep ^d > /dev/null || echo $list ; done ;
Solution5 (exclude sym links):$ for list in `ls` ; do ls -ld $list | grep -v ^l > /dev/null && echo $list ; done ;
On Windows
Solution 1: dir /a-d /b >..\File_List.txt
The Cloud is the future: The AWS Certified Solutions Architect – Associate Average salary is $149,446/year. Get Certified Now with the apps below:
Get 20% off Google Workspace (including Google Meet) Business Plan (Americas): L9H4RENHLPH76FV
