Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ MFC
I have an application that runs an inspection system and then moves & renames the resulting image files to a data folder. I used FindFirstFile(), MoveFile(), and FindNextFile() renaming the file on the move. Now I need to put the image files in a folder on a mapped drive. CreateDirectory() works great at building the directory structure on the mapped drive but ( as I am sure you all know!) MoveFile() fails. Is this a path definition issue? Do I need to specify the mapped drive as a URL? Any help will be greatly appreciated!
 
Ron H. ( In MN where we just got another 7 inches of heavey wet snow on my tulips! Errr!)
Posted 18-Apr-13 23:35pm
Comments
pasztorpisti at 19-Apr-13 5:23am
   
We don't know the exact parameters of your utility and my hints may sound obvious and foolish but MoveFile() can move files/dirs only between the directories of the same drive/volume. Between different directories you have to perform a file copy+delete combo. The MoveFile() documentation has some other comments for SMB that may be irrelevant in your case: http://msdn.microsoft.com/en-us/library/windows/desktop/aa365239%28v=vs.85%29.aspx
Malli_S at 19-Apr-13 5:26am
   
Oops !!! :)
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

The MoveFile will always fail if the destination path is on different volume. Better you copy and then delete the source file manually.
 
For your reference check this[^].
  Permalink  
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

The MoveFile will fail on Directory moves I do not think on file move to be a problem.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 587
1 Sergey Alexandrovich Kryukov 479
2 Maciej Los 305
3 BillWoodruff 220
4 Mathew Soji 195
0 OriginalGriff 7,356
1 Sergey Alexandrovich Kryukov 6,817
2 DamithSL 5,461
3 Manas Bhardwaj 4,946
4 Maciej Los 4,475


Advertise | Privacy | Mobile
Web01 | 2.8.1411023.1 | Last Updated 6 Jun 2014
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100