From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5386 invoked by alias); 21 Aug 2010 16:12:57 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 15313 Received: (qmail 8102 invoked from network); 21 Aug 2010 16:12:56 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: none (ns1.primenet.com.au: domain at closedmail.com does not designate permitted sender hosts) From: Bart Schaefer Message-id: <100821091237.ZM31306@torch.brasslantern.com> Date: Sat, 21 Aug 2010 09:12:35 -0700 In-reply-to: Comments: In reply to zzapper "copying a directory to same level" (Aug 21, 3:12pm) References: X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: copying a directory to same level MIME-version: 1.0 Content-type: text/plain; charset=us-ascii 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. --