This question already has an answer here:
I have a folder /home/Documents/myFolder
and inside this folder there are lots other folders. I want to have a file list.txt
which contains all the paths of the folders. I want the text file content like this:
/home/Documents/myFolder/1234
/home/Documents/myFolder/asd2
/home/Documents/myFolder/asdawgf
/home/Documents/myFolder/dawt
.
.
.
I tried this one but it was not what I want ls > /home/Documents/myFolde/list.txt
it just prints the folder names. I want the full paths.
Use
find
listing all directories (-type d
) and then sed the output to get the full path correct:you can use find: