From owner-freebsd-hackers@FreeBSD.ORG Thu Dec 22 15:13:54 2005 Return-Path: X-Original-To: freebsd-hackers@FreeBSD.ORG Delivered-To: freebsd-hackers@FreeBSD.ORG Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8FF0616A41F for ; Thu, 22 Dec 2005 15:13:54 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (lurza.secnetix.de [83.120.8.8]) by mx1.FreeBSD.org (Postfix) with ESMTP id DD67A43D45 for ; Thu, 22 Dec 2005 15:13:53 +0000 (GMT) (envelope-from olli@lurza.secnetix.de) Received: from lurza.secnetix.de (wdixgp@localhost [127.0.0.1]) by lurza.secnetix.de (8.13.4/8.13.4) with ESMTP id jBMFDqMh002533 for ; Thu, 22 Dec 2005 16:13:52 +0100 (CET) (envelope-from oliver.fromme@secnetix.de) Received: (from olli@localhost) by lurza.secnetix.de (8.13.4/8.13.1/Submit) id jBMFDqE7002532; Thu, 22 Dec 2005 16:13:52 +0100 (CET) (envelope-from olli) Date: Thu, 22 Dec 2005 16:13:52 +0100 (CET) Message-Id: <200512221513.jBMFDqE7002532@lurza.secnetix.de> From: Oliver Fromme To: freebsd-hackers@FreeBSD.ORG In-Reply-To: <79e2026f0512211237i4cdd2c70yc0923959d7ec1c98@mail.gmail.com> X-Newsgroups: list.freebsd-hackers User-Agent: tin/1.5.4-20000523 ("1959") (UNIX) (FreeBSD/4.11-STABLE (i386)) X-Mailman-Approved-At: Thu, 22 Dec 2005 15:16:48 +0000 Cc: Subject: Re: copy directory structure X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list Reply-To: freebsd-hackers@FreeBSD.ORG List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Dec 2005 15:13:54 -0000 Ashok Shrestha wrote: > Do you know how to copy just a directory structure (not the files inside it)? The following is probably the easiest and most efficient way ($SRC and $DST are the source and destination directories): cd $SRC; find . -type d | cpio -dumpl $DST It will also preserve permission modes and ownerships (if run as root). The command is even portable to other UNIX systems (it's not BSD-specific). If you suspect that there are filenames that could contain newline characters, use find's -print0 option and cpio's -0 option, but those are not portable. Best regards Oliver -- Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd Any opinions expressed in this message may be personal to the author and may not necessarily reflect the opinions of secnetix in any way. "A language that doesn't have everything is actually easier to program in than some that do." -- Dennis M. Ritchie