一度に複数のファイルを1つのディレクトリに移動しようとしています。
私が成功せずに試したことは次のとおりです。
mv ./*/__test__/index.js ./*/data.js
.
├── alpha
│ ├── __test__
│ │ └── index.js
│ ├── index.js
│ └── test.js
└── beta
├── __test__
│ └── index.js
├── index.js
└── test.js
これに関して:
.
├── alpha
│ ├── data.js
│ ├── index.js
│ └── test.js
└── beta
├── data.js
├── index.js
└── test.js
Unixではどうすればいいですか?
ベストアンサー1
ターゲットパラメータにはワイルドカード文字を使用できません。したがって、少なくともいくつかのスクリプトが必要です。
for d in *; do
if [[ -d "$d" ]]; then
pushd "$d"
mv __test__/index.js ./data.js
popd
fi
done