同じ名前のディレクトリ内のディレクトリとサブディレクトリの名前変更

同じ名前のディレクトリ内のディレクトリとサブディレクトリの名前変更

というディレクトリがありますDual_Loop_PLL。その中には2つのサブディレクトリagentとがありますtest。内部にはagentというディレクトリがありdl_pll_agent、内部にはdl_pll_agentそれぞれとで名前を変更したいdl_pll_agent2と思います。dl_pll_agentdl_pll_agent2dual_loop_pll_agentdual_loop_pll_agent2

次のコマンドを使用しました。

echo -e "Enter directory name you want to replace : "
read d1
echo "Enter directory name with which you want to replace : "
read d2
find  -type d -exec rename $d1 $d2 * {} +

しかし、次のエラーが発生します

rename: renaming ./Dual_Loop_PLL/agents/dl_pll_agent/dl_pll_agent2 to ./Dual_Loop_PLL/agents/dual_loop_pll_agent/dl_pll_agent2 failed: No such file or directory

ベストアンサー1

の出力は何ですかls -l ./Dual_Loop_PLL/agents ./Dual_Loop_PLL/agents/dual_loop_pll_agent

上記の質問に回答した場合は、あなたの質問に対する回答を得ることができます。

また、マニュアルrenameとbashマニュアルで引用に関するセクションを読んでください。常に変数を引用してください(例:)"$d1"

あなたが何をしているのかよくわかりません。renameand の評価、現在ディレクトリにあるすべてのファイルのリスト、見つかったファイルのリストを渡しています。$d1$d2find

おすすめ記事