Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a Seagate GoFlex NAS drive. I keep my iTunes folder there. Windows has a map from "\GOFLEX_HOME\GoFlex Home Public" to X: This all works fine. From Window's Explorer I can drag and drop files around with no issues...

I have a bunch of duplicate files in the iTunes folder so I wrote a script to parse the folder and move any duplicates. The problem is the move fails with:

Microsoft JScript runtime error: Permission denied

...even though I can do it through the Explorer. Any ideas why?

If I try to run CMD is elevated mode, it no longer sees the X: drive.

PS. The part of the script that moves the file:

function moveFile(file)
    var xroot = "X:\\dump";
    // Create all the folders
    var fldrs = file.ParentFolder.Path.split("\\");
    for (var i = 1; i < fldrs.length; i++) {
        xroot += "\\" + fldrs[i];
        try {
        } catch (e) {}
    print(file.Name + " -> " + xroot);
share|improve this question

If you want to run your script in elevated mode, then you must map the drive in your script, because in elevated mode it is running as the local administrator so it doesn't have the same drive mappings. Also, if you want to remove duplicate files (based on actual file content and not a duplicate name), I've used this for the same thing (removing duplicate songs) with good results.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.