Re: copy directory structure
- From: Julian Elischer <julian@xxxxxxxxxxxx>
- Date: Fri, 23 Dec 2005 11:56:22 -0800
Ashok Shrestha wrote:
Thank you All.
On 12/22/05, Oliver Fromme <olli@xxxxxxxxxxxxxxxxx> wrote:
Ashok Shrestha <ashok.shrestha@xxxxxxxxx> 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
add -depth
e.g.
cd $SRC; find . -type d -depth | cpio -dumpl $DST
that ensures that the timestamps on the directories are correct too. (if that matters)
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 _______________________________________________ freebsd-hackers@xxxxxxxxxxx mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
--
Ashok Shrestha
_______________________________________________
freebsd-hackers@xxxxxxxxxxx mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
_______________________________________________ freebsd-hackers@xxxxxxxxxxx mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@xxxxxxxxxxx"
- References:
- copy directory structure
- From: Ashok Shrestha
- Re: copy directory structure
- From: Oliver Fromme
- Re: copy directory structure
- From: Ashok Shrestha
- copy directory structure
- Prev by Date: Re: copy directory structure
- Next by Date: Re: [fbsd] Re: DragonFly talk at the upcoming BAYLISA (15 December 2005)
- Previous by thread: Re: copy directory structure
- Next by thread: 2 lame questions (ipfw, keyboard driver)
- Index(es):