1 /*
2  * COPYRIGHT:       See COPYING in the top level directory
3  * PROJECT:         ReactOS pending moves operations interactions tool
4  * FILE:            cmdutils/movefile/movefile.c
5  * PURPOSE:         Queue move operations for next reboot
6  * PROGRAMMERS:     Pierre Schweitzer <pierre@reactos.org>
7  */
8 
9 #include <windows.h>
10 #include <tchar.h>
11 #include <stdio.h>
12 
13 int
14 __cdecl
15 _tmain(int argc, const TCHAR *argv[])
16 {
17     /* We need source + target */
18     if (argc < 3)
19     {
20         _ftprintf(stderr, _T("Missing arguments\nUsage: %s source target\nUse \"\" as target is you want deletion\n"), argv[0]);
21         return 1;
22     }
23 
24     /* If target is empty, it means deletion, so provide null pointer */
25     if (!MoveFileEx(argv[1], (argv[2][0] == 0 ? NULL : argv[2]), MOVEFILE_DELAY_UNTIL_REBOOT))
26     {
27         _ftprintf(stderr, _T("Error: %d\n"), GetLastError());
28         return 1;
29     }
30 
31     return 0;
32 }
33