I'm trying to create a context menu to handle files/folders. I implemented this method to cut or copy files.
the copy feature seems integrated fine with windows explorer. but when i use cut, then pasting through Explorer does indeed copy the file but does not delete/remove the source file. i couldn't find a proper clear solution.
C#:
private void cutcopy(string name, bool cut)
{
StringCollection file = new StringCollection() { name };
MemoryStream stream = new MemoryStream();
stream.WriteByte(cut ? (byte)2: (byte)5);
DataObject data = new DataObject();
data.SetFileDropList(file);
data.SetData("Preferred DropEffect", stream);
Clipboard.SetDataObject(data, true);
}
the copy feature seems integrated fine with windows explorer. but when i use cut, then pasting through Explorer does indeed copy the file but does not delete/remove the source file. i couldn't find a proper clear solution.