Shell copies files with similar file names to the specified file name in bulk

Source: Internet
Author: User

Problem:

The directory structure is as follows:

test/

2001.01.01/2001.02.02/2001.03.02/

2001.01.03/2001.02.04/2001.03.05/

2001.01.04/2001.02.05/2001.03.07/

2001.01.06/2001.02.06/2001.03.08/

2001.01.12/2001.02.23/2001.03.09/

2001.01.13/2001.02.26/2001.03.22/

2001.01.24/2001.02.28/2001.03.24/

Copy the same date in the test directory to the corresponding folder, such as 2001.01 ... Copy to 2001.01/,

The code is as follows:

CD ICESat

C="'
forfileinch`ls`
Do
#filelist [$c]=$file
#c = 'Expr$c +1`
D= 'ExprSUBSTR $file17`
Echo$d
if["$d"!="$c"] ; Then
#mkdir.. /$d
# $c = $d
CP-R $d *. /$d
fi
c= $d
#awk'Nr>4{print nr-4,$6,$7,$13}'$fileA. /met1/$file
Done

Shell copies files with similar file names to the specified file name in bulk

Related Article

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.