1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
public class renomage {
public static void renom() throws IOException {
// TODO Auto-generated method stub
File appl=new File(fichiervolume.fichier()+"/as/event_application_list.html");
File secu=new File(fichiervolume.fichier()+"/as/event_security_list.html");
File syst=new File(fichiervolume.fichier()+"/as/event_system_list.html");
File sr=new File(fichiervolume.fichier()+"/as/ServeRAID Information.html");
File over=new File(fichiervolume.fichier()+"/as/system_overview.html");
if(appl.exists()==false){appl.createNewFile();}
if(secu.exists()==false){secu.createNewFile();}
if(syst.exists()==false){syst.createNewFile();}
if(sr.exists()==false){sr.createNewFile();}
if(over.exists()==false){over.createNewFile();}
File f1 = new File (fichiervolume.fichier()+ "/as/" ) ;
InetAddress ip =InetAddress.getLocalHost();
File[] strFilesDirs = f1.listFiles ( );
String ligne="";
String lignes="";String lignes1;
for ( int i = 0 ; i < strFilesDirs.length ; i ++ ) {
File nomfich=strFilesDirs[i];
if(nomfich.getName().contains("new.html")==true){nomfich.delete();}}
File f2 = new File ( fichiervolume.fichier()+"/as/" ) ;File[] strFilesDirs2 = f2.listFiles ( );
for ( int i = 0 ; i < strFilesDirs2.length ; i ++ ) {
File nomfich2=strFilesDirs2[i];
if((nomfich2.getName().contains(".html")==true)&&(nomfich2.getName().contains("new.html")==false))
{
nomfich2.renameTo(new File(nomfich2+ip.getHostAddress()+"new"+".html")); }
else{} }
}
} |