what is the difference between %p and %P in find command

bash, find, posix

Solution

Did you even try it? The `%p`, in your example, prints the file including the `olddir` part, and `%P` prints it without. Pretty much exactly what the documentation says. Simple example:

$ ls -R
.:
dir/

./dir:
file
$ find dir -name file -printf '%p\n'
dir/file
$ find dir -name file -printf '%P\n'
file

Problem

I came across use of find command in an example as follows (it copies the directory structure some where) ``` find olddir -name script.sh -printf "%p\0" -printf "newdir/%P\0" | xargs -0L2 cp -n ``` I am not clear with difference between %p and %P I read the man page of find which does not says much ``` %p File's name. %P File's name with the name of the command line argument under which it was found removed. ``` what is the difference between %p and %P I am confused with what it means by ``` %P File's name with the name of the command line argument under which it was found removed. ```

Original source