List only regular file names in a directory

You can translate the content of this page by selecting a language in the select box.

How to List only regular file names in a directory on Linux and Windows

Listing regular files in a directory without including . and .. files.


AI Unraveled: Demystifying Frequently Asked Questions on Artificial Intelligence

  • 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


    Amplify Your Brand's Exposure with the AI Unraveled Podcast - Elevate Your Sales Today! [200K downloads per Month]

error: Content is protected !!