'using find command with -print option returns an error - unknown primary or operator error
In my directory I have a bunch of folders in each folder I have one .jpeg file. I want to extract only file names of these .jpeg files. I am using:
find . -type f -print "%P\n"
but it returns an error: find: %P\n: unknown primary or operator.
I checked on the forum that they often use "printf" command instead of "print", so I tried using it as well, but it did not work:( I also tried to use single quotation '%P\n', brackets ("%P\n") - as manual suggests. But no results.
I would be very thankful if you could help me with that.
Solution 1:[1]
mashuptwice,
Your method works!
You could use
find . -exec basename {} \;instead.
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 | karel |
