2
我有很多的目錄與文件進去:子文件夾中遞歸切割文件後綴
large_fffd612bdc3fab_main
我想切後綴large_
從目錄中遞歸的所有文件,並獲得名字fffd612bdc3fab_main
我使用這個命令並與設在目錄中的文件工作
for f in `find . -depth -type f -name large_*`; do mv $f $(echo $f | cut -c1-); done;
但是當我嘗試用子文件夾來工作,我得到這樣的錯誤:
mv: './fff97489a19e89_main/large_fff97489a19e89_main' and './fff97489a19e89_main/large_fff97489a19e89_main' are the same file
請指教。 謝謝。
提示:'sh -c'... {} ...''[不安全](https://github.com/koalaman/shellcheck/wiki/SC2156)一般來說也是。考慮重寫爲'sh -c'... $ 1 ...'_ {}' –
非常棒的提示,重寫了它,謝謝! – janos
非常感謝! – dezzinto