Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of All Folders and Sub-folders [closed]

Tags:

linux

ls

In Linux, I want to find out all Folder/Sub-folder name and redirect to text file

I tried ls -alR > list.txt, but it gives all files+folders

like image 434
Sandeep540 Avatar asked Feb 12 '13 07:02

Sandeep540


People also ask

How do I get a list of folders and sub folders without the files?

Substitute dir /A:D. /B /S > FolderList. txt to produce a list of all folders and all subfolders of the directory. WARNING: This can take a while if you have a large directory.

How do I list all directories and subdirectories?

If you name one or more directories on the command line, ls will list each one. The -R (uppercase R) option lists all subdirectories, recursively. That shows you the whole directory tree starting at the current directory (or the directories you name on the command line).

How do I show all directories in CMD?

You can use the DIR command by itself (just type “dir” at the Command Prompt) to list the files and folders in the current directory.


1 Answers

You can use find

find . -type d > output.txt

or tree

tree -d > output.txt

tree, If not installed on your system.

If you are using ubuntu

sudo apt-get install tree

If you are using mac os.

brew install tree
like image 114
Adem Öztaş Avatar answered Sep 30 '22 01:09

Adem Öztaş