Using 'find' to return filenames without extension

前端 未结 9 1637
无人及你
无人及你 2020-12-15 22:37

I have a directory (with subdirectories), of which I want to find all files that have a \".ipynb\" extension. But I want the \'find\' command to just return me these filenam

9条回答
  •  余生分开走
    2020-12-15 23:10

    If you need to have the name with directory but without the extension :

    find .  -type f -iname "*.ipynb" -exec sh -c 'f=$(basename $1 .ipynb);d=$(dirname $1);echo "$d/$f"' sh {} \;
    

提交回复
热议问题