Get the App
SLTechnology News&Howtos  ›  Servers  › 

Shell script applies "five" batch production files

Shulou Source: shulou.com Published: 2022-06-02 17:00:34 10月04日 Update

Batch production file, file name randomly processed by MD5, 8 bits; batch modification of file name such as 74d03365_finished.html to 74d03365.JPG

Method 1 shell script

#! / bin/sh

For name in ls test/*.html

Do

Mv $name echo $name | sed's favorite finished.html.jpgroomg'

Done

Method 2 rename renamed the command

Rename "_ finished.html".jpg" * .html

Method 3 command line replacement

[root@localhost test] # ls | awk-F'[_]'{print "mv" $0jpg "}'| bash

[root@localhost test] # ls

0296a3c9.jpg 2e8a3794.jpg 819dc866.jpg b3be2c15.jpg c3fb54e5.jpg

1c27667d.jpg 57e7d747.jpg 9a24ebd4.jpg b4b5f192.jpg f3759add.jpg

Batch create file script

#! / bin/bash

For ((iTun1)

Tags: File method script command file name production processing application Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information vpn Shulou Technology Redmi NVidia