Ubuntu Linux Bulk Modified image size and file renaming

Source: Internet
Author: User
Tags uppercase letter

0x00

This article belongs to the essay, only for the author's study record.

0x01 Bulk Modified image size:

[Email protected]:~/$ Find/-name ' *.jpg '-exec convert-resize 220x520! {} {} \;

Note: In the above command,

The Find path-name files that match the. jpg suffix

-exec to the find result, the Convert command is followed by the convert parameter, and if convert is not installed, sudo apt-get install convert is installed.

-resize width x Height, note x is an uppercase letter X,! Indicates that the original scale of the picture is not persisted, and the cast to the set dimension {} represents the find result, which acts as the convert parameter, which represents the meta-path and destination path.

Another thing to note is that the end needs to be added \; This command only succeeds, the author failed for a long time, and later found out that this is the reason. In this bamboo-blog article, it is mentioned that the order after the-exec is to end, and to consider the different systems; there may be different meanings, so add backslashes, which is a little vague, but it's good to remember as a rule.

0x02 File Batch rename:

[Email protected]:~/$ k=100; For i in ' ls '; Do mv-f $i ' echo $ (k) ". jpg"; k=k+1; Done

Reference documents

Http://hi.baidu.com/dinohu/item/1b2463314f549aba134b14d4

Http://www.cnblogs.com/peida/archive/2012/11/14/2769248.html

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.