title: return binding.rename(pathModule._makeLong(oldPath), Error: EPERM, operation not permitted
body: <p>I have the following script:</p>
  
  <pre><code>var fs = require("fs");
  fs.renameSync(__dirname + "\\file.txt", __dirname + "\\destination");
  </code></pre>
  
  <p>Simply trying to move the file <em>file.txt</em> into the folder <em>destination</em> with Node.js using the File System API.</p>
  
  <p>Here is exactly what I run an as elevated Command Prompt as Administrator in Command Prompt and Windows PowerShell, the results plus the details:</p>
  
  <pre><code>Microsoft Windows [Version 6.3.9600]
  (c) 2013 Microsoft Corporation. All rights reserved.
  
  C:\WINDOWS\system32&gt;cd..
  
  C:\Windows&gt;cd..
  
  C:\&gt;cd Users
  
  C:\Users&gt;cd Leo
  
  C:\Users\Leo&gt;cd Desktop
  
  C:\Users\Leo\Desktop&gt;cd directory
  
  C:\Users\Leo\Desktop\directory&gt;takeown /F "C:\Users\Leo\Desktop\directory"
  
  SUCCESS: The file (or folder): "C:\Users\Leo\Desktop\directory" now owned by user "PC\
  Leo".
  
  C:\Users\Leo\Desktop\directory&gt;npm cache clean
  
  C:\Users\Leo\Desktop\directory&gt;node script.js
  fs.js:636
    return binding.rename(pathModule._makeLong(oldPath),
                   ^
  Error: EPERM, operation not permitted 'C:\Users\Leo\Desktop\directory\destination'
      at Error (native)
      at Object.fs.renameSync (fs.js:636:18)
      at Object.&lt;anonymous&gt; (C:\Users\Leo\Desktop\directory\script.js:2:4)
      at Module._compile (module.js:460:26)
      at Object.Module._extensions..js (module.js:478:10)
      at Module.load (module.js:355:32)
      at Function.Module._load (module.js:310:12)
      at Function.Module.runMain (module.js:501:10)
      at startup (node.js:129:16)
      at node.js:814:3
  
  C:\Users\Leo\Desktop\directory&gt;node -v
  v0.12.4
  
  C:\Users\Leo\Desktop\directory&gt;npm -v
  2.13.1
  
  C:\Users\Leo\Desktop\directory&gt;npm list
  C:\Users\Leo\Desktop\directory
  └── fs@0.0.2
  </code></pre>
  
  <p>I have Full Control Access (Ownership) of the related folders, subfolders and files:</p>
  
  <pre><code> C:\Users\Leo\Desktop\directory
  
   C:\Users\Leo\Desktop\directory\script.js
  
   C:\Users\Leo\Desktop\directory\file.txt
  
   C:\Users\Leo\Desktop\directory\destination
  
   C:\Users\Leo\Desktop\directory\node_modules\fs\index.js
  
   C:\Users\Leo\Desktop\directory\node_modules\fs\package.json
  </code></pre>
  
  <p>Ran <em>takeown /F</em> of each of these successfully just in case.</p>
  
  <p>Also tried alternative syntax on the file and folder paths:</p>
  
  <pre><code>fs.renameSync("C:\\Users\\Leo\\Desktop\\directory\\file.txt",
   "C:\\Users\\Leo\\Desktop\\directory\\destination");
  </code></pre>
  
  <p>Spyware protection and Virus protection disabled.</p>
  
  <p>Updated and running the latest versions of <em>node</em>, <em>npm</em> and <em>fs</em>.</p>
  
  <p>PC is Windows 8.1 Pro x64 with latest updates.</p>
  
  <p>No Outbound Firewall rules blocking <em>node</em> or <em>npm</em>.</p>
  
  <p>I have Inbound Firewall rules allowing:</p>
  
  <pre><code>C:\Program Files\nodejs\node.exe
  C:\Program Files\nodejs\npm
  </code></pre>
  
  <p>Feeling like I've exhausted all options, any ideas would be greatly appreciated.</p>