批量修改文件名称

遇到一些奇怪的名字,批量修改成相同的文件名称.

思路:匹配到特定字符,

-n 确认是否正确

-v 进行修改

rename-n's//Stm32/'*.nc/*

rename-v's/Sam3/Stm32/'*.nc/*

rename -n 's/1.fastq.gz.fastq_//' *.fastq 确认需要重命名的文件*/

rename(B1-1_combined_R1.fastq.gz.fastq_1.fastq, B1-1_combined_R1.fastq)

rename(B1-1_combined_R1.fastq.gz.fastq_2.fastq, B1-1_combined_R2.fastq)

rename -v 's/1.fastq.gz.fastq_//' *.fastq  执行修改,并列出已重命名的文件*/

## for var in `ls`; do mv -f "$var" `echo "$var" |sed 's/^...........//'`; done

## for name in `ls *.gz`;do echo $name ${name%.fq.gz}.fastq.gz;done

for name in `ls *.gz`;do mv $name ${name%.fq.gz}.fastq.gz;done

你可能感兴趣的:(批量修改文件名称)