79871

how to recursively list files from a folder?

Question:

'ls dir1/*<em>/</em>.ext' just lists all the files with just one level of nesting. What is the command to recursively list all the files with any level of nesting in linux?

Answer1:

ls -R dir1

Or:

find dir1 -name "*.ext"

Answer2:

The find command is one way to do this:

find dir1 -name .ext

The -name operator <em>can</em> take a wildcard to match with, but it's important to quote the wildcard expression so that it won't be expanded by your shell before calling into find:

find dir1 -name "*.ext"

The find command has many operators that can do various different tests on the files in the directory, of which -name is just one example. Consult <a href="http://linux.die.net/man/1/find" rel="nofollow">the find manual page</a> for more information.

Answer3:

To list folder recursively:

ls -R

Answer4:

You could use find:

find .

That command would list everything under the current folder

Recommend

  • How can I find the installation directory of a specific program?
  • R Tree With n Branches
  • Intersect on ArrayList with objects groovy
  • Watching for file changes within a directory [duplicate]
  • MySQL wildcard replace
  • Writing a recursive function on lists in Haskell
  • Multiple jQuery Mobile Count Bubbles
  • How java deals with references to a generic type
  • Combining and associating multiple dictionaries
  • Python equivalent of Scala's exists() function?
  • What is the right syntax for “timeframe” in MailChimp API 3.0
  • Can one add a complex type item to ListModel?
  • composer dependency stating in doesn't have php-xsl
  • Python to parent/child JSON
  • Comparing user's facebook/twitter friends to site's users in Python/Django
  • Generic classes with Collection getter of other types
  • Removing Duplicate Geometries
  • Portable JRE on Linux - possible?
  • Retrieving specified columns from a list of csv files to create a data data frame in R
  • How to override value that appears in a dropdown in the rails_admin gem
  • Pycharm: Marking a folder as 'sources root' is not recursive for subfolders
  • RxJava debounce by arbitrary value
  • How to use JavaScript to determine whether a file exists in a directory?
  • D3 nodes and links from JSON with nested arrays of children
  • How to model a transition system with SPIN
  • Function pointer “assignment from incompatible pointer type” only when using vararg ellipsis
  • Comma separated Values
  • Python: how to group similar lists together in a list of lists?
  • SQL merge duplicate rows and join values that are different
  • coudnt use logback because of log4j
  • Turn off referential integrity in Derby? is it possible?
  • How can I remove ASP.NET Designer.cs files?
  • python draw pie shapes with colour filled
  • Add sale price programmatically to product variations
  • Is there any way to bind data to data.frame by some index?
  • Django query for large number of relationships
  • How can i traverse a binary tree from right to left in java?
  • Unable to use reactive element in my shiny app
  • How do I use LINQ to get all the Items that have a particular SubItem?