Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: copying a directory to same level



On Sat, 21 Aug 2010, zzapper wrote:

> Hi
> (Hope this is not too dumb)
> 
> I want to duplicate directory vim73 to vim
> 
> >cp -r vim73 vim/
> 
> if directory vim does not exist then it does what I want.  However if 
> vim/ already exists then vim73/ will be created as a sub-directory in 
> vim/ eg vim/vim73
> 
> Can you explain this behaviour and how can I force it duplicate to 
> same level regardless of whether directory exists

Personally, I use rsync for anything like this.  For your particular use 
case, you'd want:

rsync -r vim73/ vim/

Note the trailing slash on vim73/.  If you omit it, you'll get a 
vim/vim73/ subdirectory.  In both cases, though, the final outcome 
doesn't depend on whether vim/ already exists.


Although, it also sounds suspiciously as though you're trying to go 
against recommendations and muck about in the $VIM/ or $VIMRUNTIME/ 
directories directly (rather than making modifications in your own home 
directory).


Or, maybe you're looking for symbolic links.  I've seen on many systems:

/usr/share/vim/current -> vim72

Modified for what I assume you might want in your example, that can be 
created by:

ln -s vim73 /usr/share/vim/vim

-- 
Best,
Ben



Messages sorted by: Reverse Date, Date, Thread, Author