Thursday, January 26, 2023
HomeApplezsh - The really helpful option to copy the contents of 1...

zsh – The really helpful option to copy the contents of 1 listing into one other


To repeat the contents of 1 listing into one other, I can use the next:

cp -Rip source-dir/ ../destination-dir/

Nonetheless, plainly utilizing the trailing slash on the finish of supply listing when utilizing cp and mv instructions is considerably discouraged.

No trailing slash on supply listing

You mustn’t put a trailing slash on the supply listing:

The purpose is related to cpbut additionally to mv, the place it’s a lot extra essential.

I am going to cite the warning from the handbook – notice that it is not discovered within the man web page, however within the data web page data coreutils 'mv invocation':

Warning: Keep away from specifying a supply title with a trailing slash,
when it may be a symlink to a listing. In any other case, ‘mv’ could do
one thing very shocking, since its habits will depend on the underlying
rename system name. On a system with a contemporary Linux-based kernel, it
fails with ‘errno=ENOTDIR’. Nonetheless, on different methods (a minimum of
FreeBSD 6.1 and Solaris 10) it silently renames not the symlink however
quite the listing referenced by the symlink.

Is it actually so? And if the reply is “sure”, what’s the really helpful option to copy the contents of a listing?



Supply hyperlink

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments