Shell batch processing picture server

Source: Internet
Author: User

Recently the leader has given a task to deal with the line-piece server, unwanted pictures to remove it.


Idea: First the line to use the image from the database to export, the table has a picture path, and then the path to generate a txt

Finally, each picture path is read from the TXT file and processed accordingly.


The following is the script used, because the picture is more, about 17W, took 2 hours, put the script up for later reference



#!/bin/bash

Cat/usr/local/src/goodimg.txt | While read line #goodimg. txt is the txt text of the picture exported from the database

Do

Dst=/opt/central-images/upfiles/goods_img2

Echo ' pwd: ' $line

Src=/opt/central-images/upfiles/goods_img

new=$ ((dirname $line) | sed "s:${src}:${dst}:g")

Echo ' new= ' $new

Echo ' copy_to: ' $new

Mkdir-p $new

echo $line $new

CP $line $new


#break;

Done


Shell batch processing picture server

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.