Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
現在、 123を含むすべてのディレクトリの名前を321に変更しようとしています。 たとえば、test123testというディレクトリがある場合、名前をtest321testに変更します。 これまでのところ、次のようなものがあり ます。元の名前に基づいてフォルダの名前を置き換える方法がわからないため find . -depth -name *123* -exec mv {} 、問題が発生しています。 進め方について何かアイデアがあれば、遠慮なく貢献してください。\;
find . -depth -name *123* -exec mv {}
\;
forループで試してください:
for dir in `find . -type d -depth X -name '*123*'` ; do mv "$dir" "${dir/123/321}" done
注:上記で編集する必要がありますX。./dir123/dir123/そして、' 'のようなパスがあると失敗する可能性があります
X
./dir123/dir123/