# File::moveFile() bug

**URL:** <https://forum.juce.com/t/file-movefile-bug/3280>\
**Category:** General JUCE discussion\
**Created:** [October 9, 2008, 2:51pm UTC](https://forum.juce.com/t/file-movefile-bug/3280 "2008-10-09T14:51:26Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![zamrate](https://avatars.discourse-cdn.com/v4/letter/z/f4b2a3/32.png) [@zamrate](https://forum.juce.com/u/zamrate)\
**Post date:** [October 9, 2008, 2:51pm UTC](https://forum.juce.com/t/file-movefile-bug/3280/1 "2008-10-09T14:51:26Z")

</div>

If the file is moved to the sample place (destination filename == source filename), then it is deleted (instead of doing nothing).

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 10, 2008, 9:12am UTC](https://forum.juce.com/t/file-movefile-bug/3280/2 "2008-10-10T09:12:26Z")

</div>

I don’t see how that can be possible… There’s a check in the code that does this:

`bool File::moveFileTo (const File& newFile) const throw()
{
    if (newFile.fullPath == fullPath)
        return true;
`

What are you doing that manages to avoid getting caught by this?

---

<div class="post-metadata">

**Author:** ![zamrate](https://avatars.discourse-cdn.com/v4/letter/z/f4b2a3/32.png) [@zamrate](https://forum.juce.com/u/zamrate)\
**Post date:** [October 10, 2008, 1:10pm UTC](https://forum.juce.com/t/file-movefile-bug/3280/3 "2008-10-10T13:10:45Z")

</div>

Hmm maybe I was in release mode (no asserts) and did something like moving (C:\test.txt) into “”, “” being also c:\ ? Is that possible?  
Don’t remember exactly how I did it but the file I moved was somehow deleted afterwards. I’ll have to check again what went wrong.

Ah I see one possibility: If I used C:/test.txt windows will still eat it, but the full paths will perhaps not correspond to each other because JUCE uses \ as delimiters, because that’s standard on Windows?

---

<div class="post-metadata">

**Author:** ![jules](https://avatars.discourse-cdn.com/v4/letter/j/41988e/32.png) [@jules](https://forum.juce.com/u/jules)\
**Post date:** [October 10, 2008, 1:41pm UTC](https://forum.juce.com/t/file-movefile-bug/3280/4 "2008-10-10T13:41:18Z")

</div>

By the time a path gets used inside a File object, it should have been normalised, so I’d expect the two strings to match, regardless of how you created them…
