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

Re: copying a directory to same level



On Aug 21,  3:12pm, zzapper wrote:
}
} (Hope this is not too dumb)

Not dumb, but it's a "cp" thing rather than a shell thing.

} >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

Referring to the "cp" documentation (GNU "info" in this case):

   If the last argument names an existing directory, `cp' copies each
   SOURCE file into that directory (retaining the same name).

Consequently what you want is:

    cp -r vim73/. vim

which will change "." to "vim" if "vim" doesn't already exist, and copy
the contents of vim73/. into vim/. if "vim" already does exist.

-- 



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