Linux Bulk Modified file name

Source: Internet
Author: User

Background: In the study of MP4 decoding playback of audio and video subtitle of the Shard naming does not conform to specifications, the number of shards too many can only be scripted implementation.

To resolve the problem type :

1. Convert garfield1hd_261_dan-*.m4s unification to GARFIELD1HD_261_DAN-*.WEBVTT format

#!/bin/bashparse_dir=/home/lcw/testcd $parse _dir#garfield1hd_261_dan-8.m4sfor var in ' ls $parse _dir/*.m4s '; Do    src_name= ' basename $var '    dst_name= ' echo $src _name | awk-f '. ' ' {print $ '. "" Webvtt "}"   # echo "CP $src _name $dst _name"    mv $src _name $DST _namedone     

  2. garfield1hd_eng_128000_257_segment-1402.m4a Remove the Segment garfield1hd_eng_128000_257-1402.m4a

#!/bin/bashparse_dir=/home/yinzhou/dashstream/media_lcw/vodafonecd $parse _dir#garfield1hd_261_dan_ segment-339.m4a#garfield1hd_eng_128000_257_segment-1402.m4afor var in ' ls $parse _dir/garfield1hd_*_*_*_segment-* '; Do    src_name= ' basename $var '    dst_name= ' echo $src _name | awk-f ' _|-' {print $ "_" $ "_" $ "_" $4 "-" $6} "    # echo "CP $src _name $dst _name"    mv $src _name $DST _namedone

  3. Remove the Segment from the garfield1hd_261_dan_segment-339.m4a garfield1hd_261_dan-339.m4a

#!/bin/bashparse_dir=/home/yinzhou/dashstream/media_lcw/vodafonecd $parse _dir#garfield1hd_261_dan_ segment-339.m4a#garfield1hd_eng_128000_257_segment-1402.m4afor var in ' ls $parse _dir/garfield1hd_*_*_segment-* '; Do    src_name= ' basename $var '    dst_name= ' echo $src _name | awk-f ' _|-' {print $ "_" $ "_" $ $ "_-" $ $} "    #echo" CP $SRC _name $dst _name "    mv $src _name $DST _namedone

  

Linux Bulk Modified file name

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.