Créer un fichier temporaire dans un répertoire spécifique

Author:

 fichier, temporaire, java
{filelink=7929}


import java.io.File;
import java.io.IOException;

public class Fichier_TempPath
 {

  public static void main(String[] args) throws IOException
  	 {
    File fichier = null;
    File rep = new File("D:/");
    fichier = File.createTempFile("temp", ".txtTmp", rep);

    // Afficher le chemin
    System.out.println(fichier.getCanonicalPath());

  }

}

Leave a Reply

Your email address will not be published. Required fields are marked *