简体   繁体   English

命令行将所有图像的视网膜显示扩展名添加到文件夹中

[英]Command line Add retina display extension to all image into a folder

What's the command line to add a retina display extension (@2x) to all images into specific folder : Ex : eximg.png -> eximg@2x.png 将视网膜显示扩展名(@ 2x)添加到特定文件夹的所有图像的命令行是什么:例如:eximg.png - > eximg@2x.png

Thanks in advance. 提前致谢。

如果文件名包含空格或特殊字符,这也适用:

for f in *.png; do mv "$f" "${f%.png}@2x.png"; done

if your filename doesn't have special letters (eg spaces), this line will print those mv cmd for you: 如果您的文件名没有特殊字母(例如空格),此行将为您打印mv cmd

 ls *.png|xargs -n1|sed -r 's/(.*)(.png)$/mv & \1@2x\2/'

and if all those commands are ok, you could pipe the output to |sh to rename your files. 如果所有这些命令都没问题,你可以将输出管道输出到|sh来重命名你的文件。

Edit 编辑

 ls *.png|xargs -n1|sed 's/\(.*\)\(.png\)$/mv & \1@2x\2/'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM