RE: Recreating Directory Trees?

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
+ (text/plain)
Delete this message
Reply to this message
Author: Lisa Kachold
Date:  
To: plug-discuss
Subject: RE: Recreating Directory Trees?

SuperTuna Man asked:

"Can I just copy that structure and leave all those files behind?"

Solutions:

tar:

tar cvf - `find /dir1 -name '*.dbf'` > dir1.tar



Whatever your find is, put it between the backticks ` `.

Go to /newdir and untar the dir1.tar
<cptree>
#!/bin/sh
if [ $# = 2 ]
then
    (cd $1; tar cf - .) | (mkdir $2; cd $2; tar xvfp -)
else
    echo "USAGE: "`basename $0`" <source_directory> <dest_directory>"
    exit 1
fi
----< cptree <----



or

$ mkdir /dir2

$ cd /dir1

$ find . -type d | cpio -pvdm ../dir2



I'm sure there are other ways.

Obnosis | (503)754-4452




PLUG Linux Security Labs 2nd Saturday Each Month@Noon - 3PM


> Subject: Recreating Directory Trees?
> From:
> To:
> Date: Fri, 3 Apr 2009 08:27:22 -0700
>
> Hello there!
>
> "Hellther."
>
> I am about to create a Ruby script to sync my music directory with my
> MP3 player. Before I start, I would like a nice test environment, as my
> MP3 player uses a particular directory tree.
>
> Is there a nice easy way to copy a directory tree without copying over
> all its files? For example, let's say the device has something like...
>
> MP3 Player
> |
> `-Videos/
> |
> `-Music/
> |
> `-Playlists/
>
>
> and in those subdirs are like over 9000 video, music, and playlist
> files. Can I just copy that structure and leave all those files behind?
> so that I have
>
> loltestdir/
> |
> `-Videos/
> |
> `-Music/
> |
> `-Playlists/
>
> but without any files in there?
>
> Thanks!
>
> -tuna
> ---------------------------------------------------
> PLUG-discuss mailing list -
> To subscribe, unsubscribe, or to change your mail settings:
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss


_________________________________________________________________
Quick access to your favorite MSN content and Windows Live with Internet Explorer 8.
http://ie8.msn.com/microsoft/internet-explorer-8/en-us/ie8.aspx?ocid=B037MSN55C0701A---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-discuss