Access and delete a file in a specific path

I want’t to access a file in a specific path.
I tried this but its not working.

File copyFile = dataFile(dataPath("C:\\wamp64\\www\\VD\\tempCopy.txt"));
if(copyFile.isFile()){
       copyFile.delete();
}

File copyFile = new File(“C:\wamp64\www\VD\tempCopy.txt” );

Replace \ with \\

2 Likes

thanks for your response,
but I don’t want to create the file, I just wan’t to access it then delete it. Btw this file is created by another process.

Is there a methode to change working directory?

You don’t create a file here, just a reference to your existing file - to delete it

1 Like

thanks for your help, it’s working.

1 Like