Questions tagged [movefileex]

21 questions
8
votes
2 answers

Is the ReplaceFile Windows API a convenience function only?

Is the ReplaceFile Windows API a convenience function only, or does it achieve anything beyond what could be coded using multiple calls to MoveFileEx? I'm currently in the situation where I need to write a temporary file and then rename this…
Martin Ba
  • 37,187
  • 33
  • 183
  • 337
4
votes
0 answers

MoveFileEx with MOVEFILE_REPLACE_EXISTING flag Fails with LastError = 183

We have an application that makes a backup of a configuration file by copying it to a sub-folder (see log file entry below) using the following command:- BOOL b = MoveFileEx(ExistingFileSpec, NewFileSpec, MOVEFILE_REPLACE_EXISTING |…
MPS
  • 41
  • 4
4
votes
1 answer

MoveFileEx with MOVEFILE_DELAY_UNTIL_REBOOT deleting rather than moving

I have an automatic update system that replaces my existing program files on reboot. (Suffice to say, it's a very complicated program with many drivers, services, and user level modules. There really is no other way. Trust me.) The function…
Charles
  • 2,642
  • 3
  • 33
  • 53
3
votes
1 answer

Copy everything from a source directory to a new directory Delphi EX7

My end goal is to copy all the relevant files from one folder to another. So e.g. we have C:\Users\Tool\Desktop\test\oldStuff. In the folder oldStuff we have more folders as well as some mp3,mp4 and txt files. Now what I would like to do is copy all…
Studying.com
  • 109
  • 1
  • 4
  • 10
3
votes
2 answers

Delete non empty folder on reboot

I am attempting to delete user profile folders in the Users folder after I remove the user from the domain. The problem is some times the folder may be in use by the system. The problem is using MOVEFILE_DELAY_UNTIL_REBOOT with MoveFileEx will only…
Scott Chamberlain
  • 124,994
  • 33
  • 282
  • 431
2
votes
1 answer

MoveFileEx - returning GetLastError(): 17

I'm using MoveFileEx to move a file. depending on what the user inputs, where it moves the files might be on a seperate hard drive. under this circumstance MoveFileEx fails with GetLastError reporting error ID 17, which is: ERROR_NOT_SAME_DEVICE 17…
user1239109
  • 31
  • 1
  • 2
2
votes
2 answers

MoveFile() Works, but returns error 2 (file not found)

I'm using the function Movefile() (in C). I can see the file moved from the source folder to the destination (means the MoveFile success) but when I do GetLastError() I get error no. 2 (ERROR_FILE_NOT_FOUND). What can be the problem? The code…
kande
  • 559
  • 1
  • 10
  • 28
1
vote
0 answers

Cancel movefile operation

I tried to schedule a movefile (using the sysinternals tool movefile) operation to delete "C:\ProgramData\Microsoft\Windows Defender\Definition Updates\Backup" but I forgot the quotes and accidently scheduled C:\ProgramData\Microsoft\Windows to move…
1
vote
0 answers

Simulate UNIX rename() with Win32 MoveFileEx() for directories

I want to simulate a specific case of the UNIX rename() function to rename directories. Its MAN page specifies: oldpath can specify a directory. In this case, newpath must either not exist, or it must specify an empty directory. I want to simulate…
vtorri
  • 166
  • 13
1
vote
0 answers

Recursive MoveFile/CopyFile

I’m working on a console program and need to use MoveFile/CopyFile to allow moving and copying files and directories (possibly across volumes). The problem of course is that copying or moving a directory to another volume does not work with the…
Synetech
  • 9,643
  • 9
  • 64
  • 96
0
votes
2 answers

Marking files for deletion using MoveFileEx

I'm having a bit of trouble getting MoveFileEx to work properly in Windows 7 x64. I'm running my application as administrator, marking files for deletion on next reboot but after rebooting find that none of the files are being deleted. I'm using the…
Clu
  • 339
  • 3
  • 8
  • 18
0
votes
0 answers

Cannot programmatically remove any image files using ::DeleteFile or "remove"

I cannot delete a jpg, png or bmp using Windows DeleteFile or remove. I can, however, delete other types of files in the same directory (txt, yaml). To make things even weirder, I can open a command prompt and remove the file using the "rm"…
MelissaS
  • 1
  • 1
0
votes
0 answers

Access is denied error while moving file using MoveFileEx on Windows

I am using MoveFileEx() API to move an existing file to a new file. I'm executing below program multiple times via a script. Below program creates a unique file on every execution, and moves it to some file, say FinalCAFile.txt. But, for some…
0
votes
0 answers

MoveFileEx not delete file after reboot

Someone could explain why MoveFileEx on following code not delete files after reboot? thanks. program Project1; {$APPTYPE CONSOLE} {$R *.res} uses Winapi.Windows, System.SysUtils; var FileName: array[0..128] of Char; FileNameZip:…
user13342561
0
votes
1 answer

Windows C++: Folder moving Access Denied error

The code below is a snippet from my project that among other things: Gets a collection of folder contents from a specified local folder (The Upload folder) Copies the contained files to a remote network folder. If there are sub folders their files…
Ben
  • 427
  • 5
  • 17
1
2