In Linux, how can I find all *.js
files in a directory recursively? The output should be an absolute path (like /pub/home/user1/folder/jses/file.js
)
this answer worked for me:
find $PWD -name '*.js' > out.txt
It finds all *.js files, output absolute path, writes the results into out.txt.
Combine 'find' and 'grep' You can also use a combination of two commands in Linux – find and grep commands to recursively search subdirectories for files that match a grep pattern (provided with the argument): find . -type f -exec grep -l 'directory_name' {} ; This command makes the task very simple.
Linux recursive directory listing using ls -R command. The -R option passed to the ls command to list subdirectories recursively.
find /abs/path/ -name '*.js'
Edit: As Brian points out, add -type f
if you want only plain files, and not directories, links, etc.
Use find
on the command line:
find /my/directory -name '*.js'
If you just want the list, then you should ask here: http://unix.stackexchange.com
The answer is: cd / && find -name *.js
If you want to implement this, you have to specify the language.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With