Tobias DiPasquale on Sat, 10 Nov 2001 06:40:22 +0100 |
Hi, If you have the Perl cookbook, you can check out Recipe 9.11, the program called symirror. It does exactly what you want. If not, I am putting it below: ---------------------- begin Perl code ------------------------- #!/usr/bin/perl -w # symirror - build spectral forest of symlinks use strict; use File::Find; use Cwd; my($srcdir, $dstdir); my $cwd = getcwd(); die "usage: $0 realdir mirrordir" unless @ARGV == 2; for (($srcdir, $dstdir) = @ARGV) { my $is_dir = -d; next if $is_dir; if (defined ($is_dir)) { die "$0: $_ is not a directory\n"; } else { mkdir($dstdir, 07777) or die "can't mkdir $dstdir: $!"; } } continue { s#^(?!/)#$cwd/#; } chdir $srcdir; find(\wanted, '.'); sub wanted { my($dev, $ino, $mode) = lstat($_); my $name = $File::Find::name; $mode &= 07777; $name =~ s!^\./!!; if (-d_) { mkdir("$dstdir/$name", $mode) or die "can't mkdir $dstdir/$name: $!"; } else { symlink("$srcdir/$name", "$dstdir/$name") or die "can't symlink $srcdir/$name to $dstdir/$name: $!"; } } ---------------------- end Perl code ------------------------- Good luck!! ----- Original Message ----- From: "M. Jackson Wilkinson" <jackw@jounce.net> To: <plug@lists.phillylinux.org> Sent: Friday, November 09, 2001 6:46 PM Subject: [PLUG] combining directories : Hey, : : Brief question... is there any way to have a directory filled with a bunch : of other directories filled with files appear as a directory of symbolic : links to the real files? Files are added to this directory heirarchy fairly : often, so it'd be ideal that it be completely dynamic. The directory is : used for two purposes, and the more important of the two requires that the : files be organized, while the other purpose can only look at one single : directory nonrecursively. : : Thanks : JW : : -- : M. Jackson Wilkinson <jackw@jounce.net> : Bowdoin College Network Operations Center : Voicemail: 877-832-9021 Cell: 207-841-9103 : : ______________________________________________________________________ : Philadelphia Linux Users Group - http://www.phillylinux.org : Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce : General Discussion - http://lists.phillylinux.org/mail/listinfo/plug : ______________________________________________________________________ Philadelphia Linux Users Group - http://www.phillylinux.org Announcements-http://lists.phillylinux.org/mail/listinfo/plug-announce General Discussion - http://lists.phillylinux.org/mail/listinfo/plug
|
|