39
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ファイルの拡張子を一括で変更する

Posted at

##もともと

ls
1.csv.gz	2.csv.gz	3.csv.gz	4.csv.gz	5.csv.gz

##ターミナル(mac)

for filename in *.csv.gz; do
> mv $filename ${filename%.csv.gz}.csv;
> done

ワンライナーでもok

for filename in *.rb; do mv $filename ${filename%.rb}.txt; done
for filename in *.!!変更前の拡張子!!; do
> mv $filename ${filename%.!!変更前の拡張子!!}.!!変更後の拡張子!!;
> done

##変更後

ls
1.csv	1.csv	1.csv	4.csv	5.csv
39
26
2

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
39
26

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?