0

The printf statement :

find directory1 -type d -printf "%P\n" | sort > file1

in the answer https://superuser.com/a/166322/856910 includes a format specifier %P. From the output of this command, I find that it removes the ./ at the beginning of a line: from ./foo to foo. What is the exact meaning of this specifier? I can't find it from man printf.

Leo
  • 3

2 Answers2

4

You need to read the man find, not man printf or man bash/help printf.

%P File's name with the name of the starting-point under which it was found removed.

choroba
  • 20,299
0

%P means "the file path with the starting point removed." Thus, it removes the ./ as you have found.

Annemie
  • 111