Scp and remote mkdir -p

Hi, I have a file path, for example / Ifshk 5 / BC_IP / PROJECT / T1 1073 / T11073_RICljiR / split / AG19_235 / 120225_I872_FCC0HN2ACXX_L8_RICljiRSYHSD2-1-IP AAPEK-17_1.fq.gz

I need to copy files from one ftp server to another. and also create a directory if it does not exist on the server. I will write to the section containing this file, then run this code

 #! /bin/bash

 while read myline
 do
   for i in $myline
    do
    if [ -f $i ]
    then
    location=$(echo "$i" | awk -F "/" '{ print "", $6, $7, $8 }' OFS="/")
        #location shows /T11073_RICekkR/Fq/AS59_59304
    location="/opt/CLiMB/Storage3/ftp/ftp_climb/100033"$location
    echo $location

    ssh tam@192.168.174.43 mkdir -p $location
    scp -r $i tam@192.168.174.43:$location

    fi
   done
 done < /ifshk5/BC_IP/PROJECT/T11073/T11073_all_3254.fq.list

it has some problem, 1. it cannot work, always shows that the permission is denied, try again. but when I'm straight type

 ssh tam@192.168.174.43 mkdir -p /sample/xxxx

it can work, and the new dir location is correct, it shows how / Opt / Rise / Warehouse3 / FTP / ftp_climb / 100033 / T11073_RICekkR / Fq / AS59_59304

+5
source share
1 answer

, " "; script bash -x, , . , , .

rsync , :

rsync --dirs $i tam@192.168.171.34:$b

--dirs ( , - ).

, rsync, :

rsync -avP /ifshk5/BC_IP/PROJECT/T11073/ tam@192.168.171.34:/opt/CLiMB/Storage3/ftp/ftp_climb/100033/

/ ! .

rsync , . , --include-from

+5

All Articles