Suppose I have this going:
$ find ./src -name '*.txt'
./src/file1.txt
./src/subdir1/file2.txt
./src/subdir1/subsubdir1/file3.txt
./src/subdir2/file4.txt
I want to exclude the directory being searched, so something like:
./file1.txt
instead of ./src/file1.txt
./subdir1/file2.txt
instead of ./src/subdir1/file2.txt
and so on.
Adding -mindepth 1
didn't do anything.
Is it possible to do what I'm after purely in find
?
find
implementation are you using? for GNUfind
, there's-printf '%P\n'
- see also Equivalent to GNU find -printf flag in other find implementationsfind
, thanks for the-printf
flag.