Currently I'm trying to find some files using the find command.

find -wholename "./blah/*.mp4"

This returns:


Is there any way I can simplify the output of this so that it only returns blah/blah2/a.mp4 without the beginning two characters (being ./)?

  • 3
    Why not just use find blah/ -name '*.mp4'. – Thomas Dec 17 '17 at 9:03
  • 1
    @Thomas That makes for an answer, do you mind adding it? – dessert Dec 17 '17 at 9:28

Use printf controls.

find -wholename "./blah/*.mp4" -printf "%P\n" 
  • Thanks! I guess the only other question would be how do I pass that into the find -exec parameter? If I use the standard {} to represent the name, it still returns the full path (with ./) instead. – kpjVideo Dec 17 '17 at 20:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.