summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-09-27 02:16:12 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-09-27 02:16:12 +0800
commit1562edeb23239f1c4e4daa38f77174d424859684 (patch)
tree144ca8a904ca454b073e698abfe01ee021dc3a6f
parent32eef65d3904b5f7f4b5b0d49a3ff64e444af1c8 (diff)
downloadpttbbs-1562edeb23239f1c4e4daa38f77174d424859684.tar
pttbbs-1562edeb23239f1c4e4daa38f77174d424859684.tar.gz
pttbbs-1562edeb23239f1c4e4daa38f77174d424859684.tar.bz2
pttbbs-1562edeb23239f1c4e4daa38f77174d424859684.tar.lz
pttbbs-1562edeb23239f1c4e4daa38f77174d424859684.tar.xz
pttbbs-1562edeb23239f1c4e4daa38f77174d424859684.tar.zst
pttbbs-1562edeb23239f1c4e4daa38f77174d424859684.zip
mvdir
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@532 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--util/mvdir.pl35
1 files changed, 35 insertions, 0 deletions
diff --git a/util/mvdir.pl b/util/mvdir.pl
new file mode 100644
index 00000000..1587b799
--- /dev/null
+++ b/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";