import java.io.*; import java.util.*; public class ImageRename { public static void main ( String args[] ) { String iPath = ""; String tPath = "/www/images/copy/"; String codeName = ""; Vector vc = fileRead ( args[0] ); for ( int i = 0; i < vc.size(); i++) { codeName = vc.elementAt(i).toString(); /* System.out.println ( tPath + codeName.substring( 0, codeName.indexOf(":") ) ); System.out.println ( codeName.substring( codeName.indexOf(":") + 1) ); */ bMove( tPath + codeName.substring( 0, codeName.indexOf(":") ).trim() , tPath + codeName.substring( codeName.indexOf(":") + 1).trim() , "_d.gif" ); } } public static Vector fileRead( String fileName ) { Vector vcF = new Vector(); try { BufferedReader in = new BufferedReader( new FileReader(fileName) ); String temp = null; while((temp = in.readLine()) !=null){ vcF.addElement( temp ); } return vcF ; } catch(IOException e){ e.printStackTrace(); return vcF ; } } public static void bMove ( String a, String b, String c) { try { copy ( a+c, b+".gif" ); } catch(IOException e) { System.out.println ( e); } } public static void copy ( String a, String b ) throws IOException { System.out.println("copy: " + a + " --> " + b ); try { File fs= new File(a); File ft = new File(b); fs.renameTo(ft); } catch(Exception e) { e.printStackTrace(); } } }