[Shell] Copy File List



Overview

Copy specific files from one directory to another directory.

readonly PWD=$(cd $(dirname ${BASH_SOURCE:-$0}); pwd)
readonly SOURCE_DIR=${PWD}/../Server/Seeds/txt/
readonly TARGET_DIR=${PWD}/Seeds/txt/
files=(
    A.txt
    B.txt
    C.txt
)

echo 'Server: ' $SOURCE_DIR
echo 'Client: ' $TARGET_DIR
for f in "${files[@]}"
do
    echo 'Copy File: ' $SOURCE_DIR$f
    cp $SOURCE_DIR$f $TARGET_DIR$f
done



歡迎您留言與分享!(Welcome for comments or sharing!)

Tagged on: