#!/usr/bin/perl -w $revlist = "revdata.txt"; #Read the revisions info of each TWiki attachment open(REVINFO,"$revlist") or die "Cannot find $revlist $!\n"; #Parse the revisions info into a data structure containing 4 fields:- #Directory:Attachment:Extension:Revision #Implement the following algo: #1. Create a directory from $2 as follows: #mkdir -p $2 #2. Create a directory matching the file name and revision info #mkdir $2/$3V$_ #3. Save each revision into its corresponding directory # co -p -r$_ $1$2$3$4 > $2/$3V$_/$3$4` while(){ m/(.*\/pub\/)(.*\/)(.*?)(\..{3}):(.*)/g; `mkdir -p $2`; @revsarray = split(/:/,$5); foreach(@revsarray) { # Create a directory matching the file name and revision info `mkdir $2/$3V$_`; # Save each revision into its corresponding directory `co -p -r$_ $1$2$3$4 > $2/$3V$_/$3$4`;} }