how would I type a file path in ubuntu terminal to include all files in all sub-directories?
If I had a main directory called “books” but had a ton of subdirectories with all sorts of different names containing files, how would I type a path to include all files in all subdirectories?
/books/???
It is unclear what you actually want … Probably you will get a better solution to your problem, if you ask directly for it, not for one other problem you’ve come accross trying to circumvent the original problem.
do you mean something like the following?
where the first
*expands for all subdirectories and the second*for all contained files ?I have chosen the
filecommand arbitrarily. You can choose whatever command you want to run on the files you get shell-expanded.Also note that directories will also be included (if not excluded by name, e.g.
*.pngor*.txt).The wildcard
*is not exactly the file path to include all files in all subdirectories but it expands to all files (or directories) matching the wildcard expression as a list, e.g.file1 file2 file3 file4. See also this tutorial on shell expansion.Note that there may be easy solutions to related problems. Like to copy all files in all subdirectories (
cp -afor example, seeman cp).I also like
findvery much. It’s quite easy to generate more flexible search patterns in combination withgrep. To provide a random example: