Reputation: 7112
How to list all java files whose absolute paths contain the word opt? this works:
$ find . -name *.java | grep "opt"
But I need the sizes of those files as well (similar to ls
)? I've tried the following but failed:
$ ls -l *opt*/*.java
$ find *opt* -name *.java
Upvotes: 0
Views: 58
Reputation: 12877
find -type f -path "*/opt/*.java" -printf "%f %s\n"
Search for a specific directory/file path using -path and then use printf to print the file name (%f) and the file size (%s)
Upvotes: 1