'How to find files without a directory path in Linux
I have a directory: test/test1/file1.sh test/file2.sh
What i need as a output: file1.sh file2.sh
I need to hide the dir.path at the output
Solution 1:[1]
It depends on your criteria which files should be included in the output, but if you want to print the names of all *.sh files under test/, you can do:
$ find <path_to_test_folder> '*.sh' -printf %f\\n
(If you're running it from the root folder of the search, you can drop the <...> part.)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | frippe |
