Need some help getting rsync or cp command right

Hello,

I am trying rsync and cp from within ssh but i’m not specifying my directories correctly.

i would like to make a copy of a folder and it’s contents that resides in the Public folder on my EX2 Ultra
to a folder that resides in the root of the USB-attached drive called MyBook.

would i specify the source directory starting with “/shares/Public/ …” ? this is what an ls print looks like when I am in the EX2 via ssh:

root@MyCloudEX2Ultra  # ls -al
drwxr-xr-x   20 root     root          1024 Feb  3 23:26 .
drwxr-xr-x   20 root     root          1024 Feb  3 23:26 ..
drwxr-xr-x    3 root     root          1024 Feb  3 23:25 CacheVolume
drwxr-xr-x    2 root     root          1024 Feb  3 23:25 bin
drwxrwxrwt    7 root     root         14540 Feb  3 23:26 dev
drwxr-xr-x   23 root     root          3072 Feb  3 23:26 etc
drwxr-xr-x    4 root     root          1024 Jan  7 00:21 home
drwxr-xr-x    2 root     root         22528 Feb  3 23:25 lib
lrwxrwxrwx    1 root     root            11 Jan  7 00:21 linuxrc -> bin/busybox
drwx------    2 root     root         12288 Jan  7 00:21 lost+found
drwxrwxrwt    6 root     root           120 Feb  3 23:25 mnt
lrwxrwxrwx    1 root     root             7 Feb  3 23:26 nfs -> /shares
drwxr-xr-x    2 root     root          1024 Feb  3 23:25 opt
dr-xr-xr-x  153 root     root             0 Dec 31  1969 proc
drwxr-xr-x    2 root     root          1024 Jan  7 00:21 root
drwxr-xr-x    6 root     root          1024 Feb  3 23:26 run
drwxr-xr-x    2 root     root          1024 Feb  3 23:25 sbin
drwxrwxrwx    2 root     root          1024 Feb  3 23:26 shares
dr-xr-xr-x   12 root     root             0 Feb  3 23:25 sys
drwxrwxrwt   10 root     root          1860 Feb 20 16:03 tmp
drwxr-xr-x    7 root     root          1024 Feb  3 23:25 usr
drwxr-xr-x   13 root     root          1024 Feb  3 23:26 var
root@MyCloudEX2Ultra  #

here is what’s in shares:

root@MyCloudEX2Ultra shares # ls -al
drwxrwxrwx    2 root     root          1024 Feb  3 23:26 .
drwxr-xr-x   20 root     root          1024 Feb  3 23:26 ..
lrwxrwxrwx    1 root     root            20 Feb  3 23:26 .wdphotos -> /mnt/HD_a4/.wdphotos
lrwxrwxrwx    1 root     root            16 Feb  3 23:26 MyBook -> /mnt/USB/USB1_b2
lrwxrwxrwx    1 root     root            20 Feb  3 23:26 Public -> /mnt/HD/HD_a2/Public
lrwxrwxrwx    1 root     root            23 Feb  3 23:26 SmartWare -> /mnt/HD/HD_a2/SmartWare
lrwxrwxrwx    1 root     root            31 Feb  3 23:26 TimeMachineBackup -> /mnt/HD/HD_a2/TimeMachineBackup
lrwxrwxrwx    1 root     root            13 Feb  3 23:26 Volume_1 -> /mnt/HD/HD_a2

root@MyCloudEX2Ultra shares #

USB drives are always mounted under the /mnt/USB directory, and the /shares directory contains symlinks to the actual path. The USB device name can change so you will have to issue an ls command to determine which USB drive is correct.

Using your example, I might use the following command if I wanted to copy everything from somefolder on the Public share to a mounted USB drive named MyBook.

cp -rf /shares/Public/somefolder/* /shares/MyBook

The -r switch means recursive copy, and the -f switch means overwrite files in the destination without prompting.

Usage: cp [OPTIONS] SOURCE... DEST

Copy SOURCE(s) to DEST

        -a      Same as -dpR
        -R,-r   Recurse
        -d,-P   Preserve symlinks (default if -R)
        -L      Follow all symlinks
        -H      Follow symlinks on command line
        -p      Preserve file attributes if possible
        -f      Overwrite
        -i      Prompt before overwrite
        -l,-s   Create (sym)links
        -T      Treat DEST as a normal file
        -u      Copy only newer files

Alternatively, you can also use the actual paths, which are the direct equivalent of the symlinked paths shown above.

cp -f /mnt/HD/HD_a2/Public/somefolder/* /mnt/USB/USB1_b2

thank you,
i saw that after i posted, tried again and it worked …