Re: Moving files in C++ using Windows SDK



> int result= MoveFileEx("\\\\computerB\\apps","c:\\apps",

So you're trying to move a folder that is the root of a share... Not good.

--PA


"RussR" <nospam@xxxxxxxxxx> wrote in message news:%23YecmBdoFHA.2472@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> What am I trying to achieve is to move a directory (or a set of files using wildcards) from one computer on the network to the
> computer that the code that's doing the moving is running. The systems are running WindowsXP Professional. Permissions on
> each directory is set to FULL for Everyone.
>
> So for example, \\computerA runs a code that will move the directory, \\computerB\\apps to c:\apps, where c:\apps is on
> computerA.
>
> Here's the line of code that I'm using which I got from the Windows SDK at
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/movefileex.asp
>
> void main() {
>
> //here's the line of code that does the moving
> int result= MoveFileEx("\\\\computerB\\apps","c:\\apps", MOVEFILE_COPY_ALLOWED |
> MOVEFILE_REPLACE_EXISTING | MOVEFILE_WRITE_THROUGH);
>
> //this is to print out the error message when it fails
> LPVOID lpMsgBuf;
> FormatMessage(
> FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
> NULL,
> GetLastError(),
> MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language
> (LPTSTR) &lpMsgBuf,
> 0,
> NULL
> );
> printf("%s\n",lpMsgBuf);
> // Free the buffer.
> LocalFree( lpMsgBuf );
> }
>
> I get an error message usually saying access denied. Permissions are all set full for everyone, so I'm stumped. If I change
> it to copy from one directory on my computer to another directory on my computer, it only works if the target directory
> doesn't already exist. If it does exist, I get an access denied error....why? I've set all the MOVEFILE flags to avoid this.
>
> Thanks,
> RussR
>
>


.



Relevant Pages

  • Moving files in C++ using Windows SDK
    ... The systems are running WindowsXP ... Permissions on each directory is set to FULL for Everyone. ... LPVOID lpMsgBuf; ... I get an error message usually saying access denied. ...
    (microsoft.public.vc.language)
  • Moving Files over the network through a program
    ... wildcards) from one computer on the network to another using a C++ program ... Permissions on each ... LPVOID lpMsgBuf; ... I get an error message usually saying access denied. ...
    (microsoft.public.windowsxp.embedded)
  • Move e-mails & delete junk or sent
    ... moving an e-mail to a folder generates this error message: ... you don't have persmission to create an entry into this folder. ... and then click properties to check your permissions ...
    (microsoft.public.outlook.general)
  • Re: File Associations Question
    ... I got the error message in Regedit. ... How to set or change registry editing permissions in Windows XP: ... Ramesh Srinivasan, Microsoft MVP [Windows Shell/User] ... Windows® Troubleshooting: http://www.winhelponline.com ...
    (microsoft.public.windowsxp.general)
  • Failed to Start Monitoring Directory Changes
    ... You receive the first error message if the Aspnet_wp.exe process identity does not have permissions on at least one of the directories in the hierarchy of that file path. ... You receive the second error message if the impersonated account does not have permissions on at least one of the directories in the hierarchy of that file path. ... Right-click the folder, and then click Properties. ...
    (microsoft.public.dotnet.framework.aspnet)