From owner-freebsd-questions@FreeBSD.ORG Fri Mar 4 21:39:13 2005 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 9068116A4CE for ; Fri, 4 Mar 2005 21:39:13 +0000 (GMT) Received: from kane.otenet.gr (kane.otenet.gr [195.170.0.27]) by mx1.FreeBSD.org (Postfix) with ESMTP id A901743D41 for ; Fri, 4 Mar 2005 21:39:12 +0000 (GMT) (envelope-from keramida@ceid.upatras.gr) Received: from gothmog.gr (patr530-a168.otenet.gr [212.205.215.168]) j24LcpDG006920; Fri, 4 Mar 2005 23:38:53 +0200 Received: from gothmog.gr (gothmog [127.0.0.1]) by gothmog.gr (8.13.3/8.13.3) with ESMTP id j24Ld3Oj001311; Fri, 4 Mar 2005 23:39:03 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Received: (from giorgos@localhost) by gothmog.gr (8.13.3/8.13.3/Submit) id j24Ld2L1001310; Fri, 4 Mar 2005 23:39:02 +0200 (EET) (envelope-from keramida@ceid.upatras.gr) Date: Fri, 4 Mar 2005 23:39:02 +0200 From: Giorgos Keramidas To: Joachim Dagerot Message-ID: <20050304213902.GA1276@gothmog.gr> References: <200503042113.j24LD51s026558@mail-core.space2u.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200503042113.j24LD51s026558@mail-core.space2u.com> cc: freebsd-questions@freebsd.org Subject: Re: Moving a directory hierarchy - best practice? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Mar 2005 21:39:13 -0000 On 2005-03-04 22:13, Joachim Dagerot wrote: > > Thanks for your suggestion. You're welcome, but *please* do not post replies _before_ the text to which you reply. It's extremely annoying to read the reply then. >>> The best suggestion was from >>> http://badgertronics.com/knowledge/one.adp?parent=25: >>> >>> To move /tmp/blarg to /var: >>> % cd /tmp >>> % tar cvf - blarg | (cd /var; tar xf -) >>> [...] >>> How do you guys move around your directory structures from prompt? >> >>I have used the following many times, with very good results: >> >> # cd /source/path >> # find . | cpio -p -dmvu /destination/dir > > Unfortunately your commands will not affect the root folder of the > hierarchy. I'm not sure I understand what you mean by "affect the root folder". > I must create a directory in the destination path with the same name > of the folder where my data is in. example: > > /home/user/level1/l2/l3/l4 > > I would like to move level1 to a new location: > > mvdir /home/user/level1 /root/ > > That would be awsome! You can do the moving in two steps: 1. Copy the directory level1 to /root/level1 2. Delete the original. These steps can easily be done with: 1. # cd /home/user/level1 # find . | cpio -p -dmvu /root/level1 2. # cd /home/user # rm -fr level1 The -dmu options to cpio are important. See the cpio manpage for details.