diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-09-27 02:16:12 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-09-27 02:16:12 +0800 |
commit | 53b9a3a3cced41f09fda3a37618314168cb2a698 (patch) | |
tree | 2b8662015ab7128d6436e6f330886ffae7decda4 | |
parent | 52ddc032f17358a7a9a3978215a2d0f61b09a3ec (diff) | |
download | pttbbs-53b9a3a3cced41f09fda3a37618314168cb2a698.tar pttbbs-53b9a3a3cced41f09fda3a37618314168cb2a698.tar.gz pttbbs-53b9a3a3cced41f09fda3a37618314168cb2a698.tar.bz2 pttbbs-53b9a3a3cced41f09fda3a37618314168cb2a698.tar.lz pttbbs-53b9a3a3cced41f09fda3a37618314168cb2a698.tar.xz pttbbs-53b9a3a3cced41f09fda3a37618314168cb2a698.tar.zst pttbbs-53b9a3a3cced41f09fda3a37618314168cb2a698.zip |
mvdir
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@532 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/util/mvdir.pl | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/pttbbs/util/mvdir.pl b/pttbbs/util/mvdir.pl new file mode 100644 index 00000000..1587b799 --- /dev/null +++ b/pttbbs/util/mvdir.pl @@ -0,0 +1,35 @@ +#!/usr/bin/perl +if( !@ARGV ){ + print "usage: mvdir.pl which prefix from_id to_id\n"; + exit; +} + +($which, $prefix, $from_id, $to_id) = @ARGV; +$which = 'man/boards' if( $which eq 'man' ); + +$fromdir = "/scsi$from_id/bbs/$which/$prefix"; +$todir = "/scsi$to_id/bbs/$which/$prefix"; + +if( !-e $fromdir ){ + print "from dir ($fromdir) not found\n"; + exit; +} + +mkdir $todir; +chdir $fromdir; +foreach( <*> ){ + next if( /^\./ ); + symlink("$fromdir/$_", "$todir/$_"); + push @dirs, $_; +} + +unlink "/home/bbs/$which/$prefix"; +symlink($todir, "/home/bbs/$which/$prefix"); + +foreach( @dirs ){ + printf("processing %-20s (%04d/%04d)\n", $_, ++$index, $#dirs); + unlink "$todir/$_"; + `mv $fromdir/$_ $todir/$_`; +} + +rmdir "$fromdir"; |