Issue archive: more selective
This commit is contained in:
parent
aecb3f3707
commit
02520733cc
1 changed files with 20 additions and 10 deletions
|
@ -16,30 +16,40 @@ public class IssueArchiver
|
||||||
{
|
{
|
||||||
public static void main(String[] args) throws Exception
|
public static void main(String[] args) throws Exception
|
||||||
{
|
{
|
||||||
if ( args.length < 2 )
|
if ( args.length < 3 )
|
||||||
{
|
{
|
||||||
System.out.println( "usage : IssueArchiver <suspect-dir> <suspect-archive>" );
|
System.out.println( "usage : IssueArchiver <new-suspect-dir> <old-suspect-dir> <suspect-archive>" );
|
||||||
System.exit(1);
|
System.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
File suspectDir = new File( args[0] );
|
File newSuspectDir = new File( args[0] );
|
||||||
if ( !suspectDir.isDirectory() )
|
if ( !newSuspectDir.isDirectory() )
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException( "not a directory: " + suspectDir );
|
throw new IllegalArgumentException( "not a directory: " + newSuspectDir );
|
||||||
}
|
}
|
||||||
File suspectArchive = new File( args[1] );
|
File oldSuspectDir = new File( args[1] );
|
||||||
|
if ( !oldSuspectDir.isDirectory() )
|
||||||
|
{
|
||||||
|
throw new IllegalArgumentException( "not a directory: " + oldSuspectDir );
|
||||||
|
}
|
||||||
|
File suspectArchive = new File( args[2] );
|
||||||
if ( !suspectArchive.isDirectory() )
|
if ( !suspectArchive.isDirectory() )
|
||||||
{
|
{
|
||||||
throw new IllegalArgumentException( "not a directory: " + suspectArchive );
|
throw new IllegalArgumentException( "not a directory: " + suspectArchive );
|
||||||
}
|
}
|
||||||
|
|
||||||
File[] files = suspectDir.listFiles();
|
File[] newFiles = newSuspectDir.listFiles();
|
||||||
for ( File f : files )
|
for ( File newFile : newFiles )
|
||||||
{
|
{
|
||||||
String name = f.getName();
|
String name = newFile.getName();
|
||||||
if ( name.startsWith( "suspects_" ) && name.endsWith( ".txt" ) )
|
if ( name.startsWith( "suspects_" ) && name.endsWith( ".txt" ) )
|
||||||
{
|
{
|
||||||
BufferedReader br = new BufferedReader( new FileReader( f ) );
|
File oldFile = new File( oldSuspectDir, name );
|
||||||
|
if ( !oldFile.exists() ) continue;
|
||||||
|
|
||||||
|
System.out.println( "archiving " + oldFile );
|
||||||
|
|
||||||
|
BufferedReader br = new BufferedReader( new FileReader( oldFile ) );
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
String line = br.readLine();
|
String line = br.readLine();
|
||||||
|
|
Loading…
Reference in a new issue