How to list all files in a directory with absolute paths

command linefilenamesls

I need a file (preferably a .list file) which contains the absolute path of every file in a directory.

Example dir1: file1.txt file2.txt file3.txt

listOfFiles.list:

/Users/haddad/dir1/file1.txt
/Users/haddad/dir1/file2.txt
/Users/haddad/dir1/file3.txt

How can I accomplish this in linux/mac?

Best Answer

ls -d "$PWD"/* > listOfFiles.list
Related Question