Recreating Directory Trees?
Lisa Kachold
lisakachold at obnosis.com
Fri Apr 3 17:04:11 MST 2009
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 at Noon - 3PM
> Subject: Recreating Directory Trees?
> From: tuna at supertunaman.com
> To: plug-discuss at lists.plug.phoenix.az.us
> 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 - PLUG-discuss at lists.plug.phoenix.az.us
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20090404/b3abe5dd/attachment.htm
More information about the PLUG-discuss
mailing list