Example: Rename the quote file (MV + rename)

Source: Internet
Author: User

Analysis:

Quotations are downloaded in a package by period;

It is inconvenient to decompress all the files to a folder;

We hereby rename the quotations;

No need to care about the number of the original period;

Re-establish the inertial thinking model;

Used to count the total number of quote files to indicate prefix variables in the loop

-> Rename rules:

Retain source file information to text

Add a prefix to an audio file

The name order does not need to be fixed during naming.

Each audio is a separate story, although different periods do not need to be consistent, break the inherent thinking, and re-establish an audio-visual loop.

From 001 to the total number of files

Eg: audioaudio-> 001.audioaudio

-> Preliminary judgment:

Two for loops using a single layer

Obtain the name of each original file.

Obtain each prefix

Finally, the original file = prefix. Original file

Conversion completed.

-> Modify the preceding judgment:

Global variables are used for prefix representation.

A loop is used to traverse the file name

Use global variable auto-increment in the loop to get the next prefix

Combined into the final file name

-> Episode

The todo folder contains N audio files of the following categories:

1> Poetry

2> 26 .mp3 .mp3

3> 24. 文.mp3


3> MV-VF ??. *. MP3 ../doing/# Move the file starting with a number and a vertex to the doing folder.

1> MV-VF [^ 0-9] *. MP3 ../done/# Move files not starting with a number to the done folder.

2> the rest is a file starting with a number.


Remove the numeric prefix and numeric prefix of all file names

1> various objects in todo. List

2> various files in doing. List


Example:

$ Vim rllr


# ------- Various files in todo. List -------

#00000-9000000000-90000xxx.mp3

Function doublenumber (){

Oriaudioname = $1

Aftaudioname =$ {oriaudioname: 2}

MV-F $ oriaudioname $ aftaudioname

}


For Audioname in 'LS'

Do

Doublenumber $ Audioname

Done


# ------- Various files in doing. List -------

#%0-9%%0-9%.xxx.mp3

Function doublenumberdot (){

Oriaudioname = $1

Aftaudioname =$ {oriaudioname: 3}

MV-F $ oriaudioname $ aftaudioname

}


For Audioname in 'LS'

Do

Doublenumberdot $ Audioname

Done


# ------- Batch rename quotations -------

#./Rename *

Prefix = 1

For Audioname in 'LS'

Do

Echo ""

Echo "Audioname:" $ Audioname

Len = 'expr length $ prefix'

If [$ Len = 1]; then

_ Prefix = 00 $ prefix

Elif [$ Len = 2]; then

_ Prefix = 0 $ prefix

Elif [$ Len = 3]; then

_ Prefix = $ prefix

Else

Echo "audio file don't have too finished ."

Fi


MV-F $ Audioname 'echo "$ _ prefix". $ audioname'

Prefix = $ ($ prefix + 1 ))

Echo $ prefix

Done


Note:

./Rllr

Go to the audio directory and execute this script.


This article is from the "andyhdchoice" blog, please be sure to keep this source http://andyhdchoice.blog.51cto.com/1521623/1548795

Example: Rename the quote file (MV + rename)

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.