Have Find print just the filenames, not full paths

后端 未结 5 625
迷失自我
迷失自我 2020-12-14 01:15

I\'m using the find command in a ksh script, and I\'m trying to retrieve just the filenames, rather than the full path. As in, I want it to return text.exe, not //severname/

5条回答
  •  独厮守ぢ
    2020-12-14 01:34

    GNU find natively supports this using -printf so all that you need to do is

    find ... -printf '%f\n'
    

    Update: Oops... this was already covered in the answer by @glenn-jackman which I somehow missed to see.

提交回复
热议问题