1

Before you downvote, I have read the following solutions:

  1. How do I copy file named starting with a dot?
  2. How to copy with cp to include hidden files and hidden directories and their contents?
  3. Linux / Unix: scp Copy All Hidden Dot Files on nixCraft.

All the solutions involve copying all the files not a single file. Now, i tried various things but, it doesn't work.

Also, i'm using zsh so don't have shopt

This should be simple, i am not stupid but, after wasting all night, i finally ask here..

Funny thing is i do get an ouptput saying it has successfully copied the file but, there is no file at destination.

cmd: cp -av ~/.zshrc /home/dobi/aaa/bckup/dotfiles

Output: '/home/xyz/.zshrc' -> '/home/xyz/aaa/bckup/dotfiles/.zshrc'

OS: mint 19 Tara

Shell: zsh

Thank you

1 Answer 1

3

Your command is correct and the output is as expected. The trap you fell into is, that the file is correctly copied, but you don't see it at its destination because it is hidden (because it starts with a dot).

Try ls '/home/xyz/aaa/bckup/dotfiles/.zshrc' or ls -a '/home/xyz/aaa/bckup/dotfiles/' from a terminal to verify it is really there - the -a stands for all and will show the normally hidden dotfiles.

If you use a graphical file manager, use the options to disable hiding of dotfiles, this is often achieved by Ctl-H.

1
  • OMFG! I don't believe this! I even had watch going on in that folder and since i could see the update i was shocked to say the least! Thanks man!
    – jodobear
    Commented Jan 25, 2020 at 0:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .