MOVE anomaly

#1
I just did this.
Code:
c:\users\vefatica\desktop> move Windows6.1-KB2670838-x86.msu \\lucky\c$\Users\vefatica\Desktop\
The MOVE succeeded, but the file's icon remained on the local desktop. That's unusual. I'm accustomed to seeing Explorer update folder views when TCC deletes or copies files. Is MOVE different?
 

rconn

Administrator
Staff member
May 14, 2008
10,551
97
#2
This doesn't have anything to do with TCC.

MOVE calls the Windows MoveFileWithProgress API. If it succeeds and you have the notify shell option set, it then calls SHChangeNotify. (Do you have the notify option set?)

If the MoveFileWithProgress call fails, MOVE calls CopyFileEx and then deletes the source.

COPY just calls CopyFileEx.
 
#3
I do have "Notify Windows Shell on File or Directory Change? checked.

I just tried again. If I MOVE the file, it's moved but its desktop icon remains (in a rather sorry state). OTOH, if I DEL the file, the desktop icon disapears.
 

rconn

Administrator
Staff member
May 14, 2008
10,551
97
#4
I do have "Notify Windows Shell on File or Directory Change? checked.

I just tried again. If I MOVE the file, it's moved but its desktop icon remains (in a rather sorry state). OTOH, if I DEL the file, the desktop icon disapears.
Then it's probably the SHChangeNotify call(which passes the SHCNE_RENAMEITEM flag). Apparently Microsoft didn't want to support renaming to another drive / device in SHChangeNotify.
 
#5
Odd! If an explorer window showing the source folder is open, then after a MOVE the source file disappears.
That's also true for the desktop ... if I have an Explorer window showing the desktop folder's contents, then after moving a file from the desktop, it disappears from the Explorer folder and also from the actual desktop.
 
#7
The anomaly is the same when moving a file from another drive *TO* the desktop; an icon does not appear on the desktop (but does if there's also an Explorer window open showing the desktop's contents.
 
#8
It soesn't seem too hard to get the desktop updated. This does it.
Code:
WCHAR szSource[MAX_PATH] = L"c:\\users\\vefatica\\desktop\\test.file";
WCHAR szDest[MAX_PATH] = L"k:\\test.file";
MoveFileWithProgress(szSource, szDest, NULL, NULL, MOVEFILE_COPY_ALLOWED);