# Access and delete a file in a specific path

**URL:** https://discourse.processing.org/t/access-and-delete-a-file-in-a-specific-path/31988
**Category:** Beginners
**Tags:** homework
**Created:** [August 28, 2021, 4:15pm UTC](https://discourse.processing.org/t/access-and-delete-a-file-in-a-specific-path/31988 "2021-08-28T16:15:04Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Fofana](https://avatars.discourse-cdn.com/v4/letter/f/f04885/32.png) [@Fofana](https://discourse.processing.org/u/Fofana)
#### Post date: [August 28, 2021, 4:15pm UTC](https://discourse.processing.org/t/access-and-delete-a-file-in-a-specific-path/31988/1 "2021-08-28T16:15:04Z")

</div>

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

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

```

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [August 28, 2021, 5:28pm UTC](https://discourse.processing.org/t/access-and-delete-a-file-in-a-specific-path/31988/2 "2021-08-28T17:28:48Z")

</div>

> [@Fofana](#):
>
> File copyFile = dataFile(dataPath(“C:\wamp64\www\VD\tempCopy.txt”));

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

Replace \ with` \\`

---

<div class="post-metadata">

### Author: ![Fofana](https://avatars.discourse-cdn.com/v4/letter/f/f04885/32.png) [@Fofana](https://discourse.processing.org/u/Fofana)
#### Post date: [August 28, 2021, 7:06pm UTC](https://discourse.processing.org/t/access-and-delete-a-file-in-a-specific-path/31988/3 "2021-08-28T19:06:46Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![Chrisir](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/chrisir/32/45_2.png) [@Chrisir](https://discourse.processing.org/u/Chrisir)
#### Post date: [August 28, 2021, 7:54pm UTC](https://discourse.processing.org/t/access-and-delete-a-file-in-a-specific-path/31988/4 "2021-08-28T19:54:16Z")

</div>

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

---

<div class="post-metadata">

### Author: ![Fofana](https://avatars.discourse-cdn.com/v4/letter/f/f04885/32.png) [@Fofana](https://discourse.processing.org/u/Fofana)
#### Post date: [August 28, 2021, 9:37pm UTC](https://discourse.processing.org/t/access-and-delete-a-file-in-a-specific-path/31988/5 "2021-08-28T21:37:48Z")

</div>

thanks for your help, it’s working.
