Re: Moving Files over the network through a program




RussR,

You should probably post this question to a Win32 dev newsgroup.

But anyway.. MoveFile[Ex] cannot move a directory to a different file system or volume. When moving a directory, the destination
must be on the same drive.

You should use some other APIs to accomplish that. E.g., SHFileOperation (shell32.dll must be in your XPe image if you further want
to use the code there).
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/reference/functions/shfileoperation.asp

--
Regards,
KM


> 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 another using a C++ program 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 where I got the line of code that I'm using to move files.
> 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

  • RE: XP wont boot
    ... Error Message When You Restart Your Computer or Upgrade to Windows XP ... • The file system is damaged and cannot be mounted. ... Note that a variety of issues can cause file system damage, ...
    (microsoft.public.windowsxp.general)
  • Re: Harddrive not recognized
    ... Just tried the sharing: I get an error message: 'The ... volume des not contain a recognized file system. ... >- When you boot your disk with a win98 boot disk from ...
    (microsoft.public.win2000.hardware)
  • Re: system32.exe
    ... Remove remnants of KWBot.Worm from the Registry and File System ... This worm causes an error message that "CMD32.EXE" cannot be found on startup. ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: get_block after EOF
    ... > I have a file system that is implemented using a ... > function behave if given a block number outside ... then Panic would be The Right Thing (BUG ... If this might happen, return 0, but print an error message to the log. ...
    (comp.os.linux.development.system)