Home » Questions » Computers [ Ask a new question ]

Linux: list contents of sub directories with given name?

Linux: list contents of sub directories with given name?

I'm using linux to analyze a windows directory structure. The structure is:

Asked by: Guest | Views: 295
Total answers/comments: 2
Guest [Entry]

"ls -R path_to_your_dir

or

ls -lR path_to_your_dir

for better view

However, best view is achieved with

find path_to_your_dir

NOTE: -R means recursive"
Guest [Entry]

"If you want the recursive listing of files and folders under Documents and Settings/User/My Documents:

find Documents\ and\ Settings/*/My\ Documents -print

If you only want only the files and folders directly under Documents and Settings/User/My Documents:

ls -dr Documents\ and\ Settings/*/My\ Documents/*

The former will include a file like Documents and Settings/User/My Documents/dir1/file1, whereas the latter will list only Documents and Settings/User/My Documents/dir1"