Hello,

Using this script derived from a scriptcenter example, I'm trying to
move a file:

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\Temp" , "C:\Logs"

The above works but when I change the destination to a different
drive:

Set objFSO = CreateObject("Scripting.FileSystemObject")
objFSO.MoveFolder "C:\Temp" , "D:\Logs"

the script fails. I can move a folder from some source on C:\ to some
other location on C:\. But if the same operation tries to move from
C:\ -> D:\ then it fails with:

Line 2 Char 1
Permission denied
800A0046

What is really confusing to me is I'm running the script as a member
of domain administrators and that account has write access to D:\.
How can I get this script to move folders across drives?

Suggestions are greatly appreciated.

Thanks!

Re: Problem with moving a file by Pegasus

Pegasus
Fri May 02 00:21:54 CDT 2008


"Adam Sandler" <corn29@excite.com> wrote in message
news:b032b5b6-7f15-492a-a0b9-de26fa57a6fc@q1g2000prf.googlegroups.com...
> Hello,
>
> Using this script derived from a scriptcenter example, I'm trying to
> move a file:
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> objFSO.MoveFolder "C:\Temp" , "C:\Logs"
>
> The above works but when I change the destination to a different
> drive:
>
> Set objFSO = CreateObject("Scripting.FileSystemObject")
> objFSO.MoveFolder "C:\Temp" , "D:\Logs"
>
> the script fails. I can move a folder from some source on C:\ to some
> other location on C:\. But if the same operation tries to move from
> C:\ -> D:\ then it fails with:
>
> Line 2 Char 1
> Permission denied
> 800A0046
>
> What is really confusing to me is I'm running the script as a member
> of domain administrators and that account has write access to D:\.
> How can I get this script to move folders across drives?
>
> Suggestions are greatly appreciated.
>
> Thanks!

Your Subject line says "moving a file" but you're actually moving
a folder. While you can move files with the "movefile" method from
one drive to another, you cannot move folders with the "movefolder"
method.



Re: Problem with moving a file by Tom

Tom
Fri May 02 08:05:47 CDT 2008

On May 2, 1:21 am, "Pegasus \(MVP\)" <I....@fly.com.oz> wrote:
> "Adam Sandler" <cor...@excite.com> wrote in message
> news:b032b5b6-7f15-492a-a0b9-de26fa57a6fc@q1g2000prf.googlegroups.com...
>
> > Hello,
>
> > Using this script derived from a scriptcenter example, I'm trying to
> > move a file:
>
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > objFSO.MoveFolder "C:\Temp" , "C:\Logs"
>
> > The above works but when I change the destination to a different
> > drive:
>
> > Set objFSO = CreateObject("Scripting.FileSystemObject")
> > objFSO.MoveFolder "C:\Temp" , "D:\Logs"
>
> > the script fails. I can move a folder from some source on C:\ to some
> > other location on C:\. But if the same operation tries to move from
> > C:\ -> D:\ then it fails with:
>
> > Line 2 Char 1
> > Permission denied
> > 800A0046
>
> > What is really confusing to me is I'm running the script as a member
> > of domain administrators and that account has write access to D:\.
> > How can I get this script to move folders across drives?
>
> > Suggestions are greatly appreciated.
>
> > Thanks!
>
> Your Subject line says "moving a file" but you're actually moving
> a folder. While you can move files with the "movefile" method from
> one drive to another, you cannot move folders with the "movefolder"
> method.

I remember this subject coming up recently and you said the same
thing, however, since all of the WSH documentation and the Script
Center example says otherwise, it might be useful to refer back to
that recent thread. It should shed some light on the issue for the OP
as well as indicate workarounds.

http://groups.google.com/group/microsoft.public.scripting.wsh/browse_frm/thread/064d1389d103b01d/653eaacfbff28e2c?#653eaacfbff28e2c

Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/

Re: Problem with moving a file by Adam

Adam
Fri May 02 12:52:17 CDT 2008


> Your Subject line says "moving a file" but you're actually moving
> a folder. While you can move files with the "movefile" method from
> one drive to another, you cannot move folders with the "movefolder"
> method.

My mistake... I'm trying to move a folder. I'm using the movefolder
method. Sorry for the confusion; I posted this at 11 PM local time
after a long day. I'm trying to move a folder and I keep getting the
permission error. I don't know how to get around the error.

Thanks!

Re: Problem with moving a file by Pegasus

Pegasus
Fri May 02 14:37:05 CDT 2008


"Adam Sandler" <corn29@excite.com> wrote in message
news:2ed09a76-daec-4e70-90ed-23544bebb1f4@m36g2000hse.googlegroups.com...
>
>> Your Subject line says "moving a file" but you're actually moving
>> a folder. While you can move files with the "movefile" method from
>> one drive to another, you cannot move folders with the "movefolder"
>> method.
>
> My mistake... I'm trying to move a folder. I'm using the movefolder
> method. Sorry for the confusion; I posted this at 11 PM local time
> after a long day. I'm trying to move a folder and I keep getting the
> permission error. I don't know how to get around the error.
>
> Thanks!

You need to copy the folder, then delete the original.