Re: 更改副檔名 - Linux

Table of Contents

※ 引述《soem (流水)》之銘言:
: ※ 引述《"[email protected]" <[email protected]>, 看板: Linux》之銘言:
: 看看有沒有 /usr/X11R6/bin/rename 這個程式。
: 試試:
: find . -name \*.txt | xargs rename 's/txt/c/' '{}'
: 或是
: find . -name \*.txt -exec rename 's/txt/c/' '{}' \;

抱歉翻這麼久的文出來回
上面的例子如果是我我可能會這樣下指令

rename 's/.txt/.c/g' *.txt

用find跟不用find差在哪裡?
因為find . 會一路迴遞到子目錄深處嘛?

但是如果沒有rename只能用mv來改副檔名
那麼指令該怎麼下呢?

懇請解惑謝謝

--
If a man has a strong faith he can indulge in the luxury of skepticism.
--Friedrich Nietzsche

--

All Comments

Gary avatarGary2013-04-02
for f in *.txt ; do mv "$f" "${f%.txt}.c" ; done 這樣?
Mary avatarMary2013-04-04
3Q