0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

【忘備録】bashでディレクトリ内のファイルの拡張子を一斉書き換え

Last updated at Posted at 2025-03-07

forでディレクトリ内のファイルを取得し、mvでファイル名の後ろ4文字(.拡張子)を削除してファイル名変換

for file in *
do
mv "$file" "${file::-4}"
done

1行で書くとこんな感じ

for file in *; do mv "$file" "${file::-4}"; done

${file::-4}の後ろに、変換したい拡張子(.mp4とか)を入れれば書き換えできます。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?