Friday, June 11, 2010

How to use MoveFile and PendMoves to move or delete a file that is always in use

If you’re using a file and trying to move it, the Operating System will not let you do that. This matches for the files that are used by the Operating System or by any Application. If you’re still looking for it, there are some possibilities. If a file is constantly in use, you can schedule Windows Vista to move the file during the Startup using the MoveFile Tool that is available for download.

You have to use MoveFile exactly like you would use the Move command. For example:
movefile file.txt test\file.txt
Movefile v1.0 - copies over an in-use file at boot time
Move successfully scheduled.

Remember that the file will not be moved immediately. However, if you restart the Computer the next time, the Windows will move the file. At the same time, if you want to delete a file that is constantly in use, you’ve to provide "" as the destination. For example:



movefile file2.txt ""
Movefile v1.0 - copies over an in-use file at boot time
Move successfully scheduled.

The same download has the MoveFile and the PendMoves command that displays the moves and deletions that have been scheduled. Therefore, you can simply run the command without parameters, as the following command specifies.
pendmoves
PendMove v1.1
Copyright (C) 2004 Mark Russinovich
Sysinternals - wwww.sysinternals.com
Source: C:\Users\User1\Documents\file.txt
Target: C:\Users\User1\Documents\dest\file.txt
Source: C:\Users\User1\Documents\file2.txt
Target: DELETE
Time of last update to pending moves key: 2/27/2008 10:08 AM

By