Search code examples
cshls

List too long for `ls` command, CSH


I want to get a list of all my files of ofl type in several directories. I used the fallowing command:

ls RESULTS/*/quakesim/iecrud/quake/fgb/stflt/*.ofl

but I got a message: /bin/ls: Argument list too long. There are a little more than 1600 such files. Is there a way to still get the list of files?

EDIT:

I need the paths to the files and not just how many are there the wc was as a try to see how many files I have without "polluting" my screen with 1600+ paths.


Solution

  • Use find instead of ls.

    Example: (assuming your current working directory is the parent of RESULTS)

    find . -name "RESULTS/*/quakesim/iecrud/quake/fgb/stflt/*.ofl" -print

    Second option:

    find . -print | egrep '.ofl$'