Welcome to the Linux Foundation Forum!

Lab 10.2

Battogtokh
Battogtokh Posts: 23
edited May 2017 in LFS211 Class Forum

Hi Everyone,

I am little bit confused with what is the difference with and without trailing . (dot) in rsync command in the LAB 10.2. It said "Note the . at the end of the command", and it makes me wonder why "." is needed in the end of this command. I tried without "." and don't see any difference. Can you please advise? 

 

 

Comments

  • lee42x
    lee42x Posts: 380
    edited May 2017

    The trailing dot in the rsync destionaton stops the automatic creation of output directories. This helps make the rsync  more specific as to where it will store files.  Consider: 

    $ rm -fr /tmp/LFT*

    $ rsync -avx  LFT  student@localhost:/tmp/LFT/ 

    One would probably expect to see the output as  /tmp/LFT/<files>  

    but the files will be in /tmp/LFT/LFT<files> 

    Not what I had in mind.

    If we use the trailing dot, which stops directory creation the top level directory we can see rsync is not creating the top level directory. 

    $ rm  -fr /tmp/LFT

    $ rsync   -avx FLT student@localhost:/tmp/LFT/.    #--> generates an error 

    $ mkdir /tmp/LFT 

    $ rsync -avx LFT student@localhost:/tmp/LFT/.    #--> the command works but still generates the extra directory

     Now by refining the input specification to copy only the files: 

    $ rm -fr /tmp/LFT

    $ mkdir /tmp/LFT 

    $ rsync -avx LFT/. student@localhost:/tmp/LFT/. 

    We get just the files from the original directory placed in the directory we created. This gives percise control where the files are placed. 

     

     

  • Battogtokh
    Battogtokh Posts: 23
    edited May 2017

    Thank you very much. 

Categories

Upcoming Training