If you try to move a folder that has a file in it that is currently being used windows gives you an error, saying it can't be moved. What happens though, is that all the files in the folder that aren't being used end up getting moved and the one file that isn't being used ends up staying in its original location. So you get all these folders and files that are missing their previous neighboring files/folder. Is there a way to set windows to either fail if something is being used or allow the move operation as long as 100% of all files/folders are not in use? Would be nice if the os just wouldn't let you do the move operation at all. Like the whole operation would just fail. So that nothing gets moved. So 100% of the files/folders need to be free in order for anything to move. Sometimes files get left in use for odd reasons. Like sometimes apps don't let them go even after you close them. You end up with all these missing files if you move a huge directory while some of the files are in use. Is there anyway get a message that tells you exactly what app is using a file? The message only tells you that something is using the file/folder, but not which app. it is.
"Potion9" wrote in message news:AD62E4C6-0258-428A-A11A-F717E919496E@microsoft.com... > If you try to move a folder that has a file in it that is currently being > used windows gives you an error, saying it can't be moved. What happens > though, is that all the files in the folder that aren't being used end up > getting moved and the one file that isn't being used ends up staying in its > original location. So you get all these folders and files that are missing > their previous neighboring files/folder. Is there a way to set windows to > either fail if something is being used or allow the move operation as long as > 100% of all files/folders are not in use? Would be nice if the os just > wouldn't let you do the move operation at all. Like the whole operation would > just fail. So that nothing gets moved. So 100% of the files/folders need to > be free in order for anything to move. > > Sometimes files get left in use for odd reasons. Like sometimes apps don't > let them go even after you close them. You end up with all these missing > files if you move a huge directory while some of the files are in use. Actually, the move operation will fail as soon as it encounters an open file, even if there are other files left that could be moved. The only way around this problem is to try to copy the files. If this succeeds, try to delete them. If this fails, move back the files that were actually deleted. > Is there anyway get a message that tells you exactly what app is using a > file? The message only tells you that something is using the file/folder, but > not which app. it is. No. There are third party tools (such as from SysInternals) that can give you this information. -- -GJC [MS Windows SDK MVP] -Software Consultant (Embedded systems and Real Time Controls) - http://www.mvps.org/ArcaneIncantations/consulting.htm -gchanson@mvps.org
"Potion9" wrote in message news:AD62E4C6-0258-428A-A11A-F717E919496E@microsoft.com... > If you try to move a folder that has a file in it that is currently being > used windows gives you an error, saying it can't be moved. What happens > though, is that all the files in the folder that aren't being used end up > getting moved and the one file that isn't being used ends up staying in > its > original location. So you get all these folders and files that are missing > their previous neighboring files/folder. Is there a way to set windows to > either fail if something is being used or allow the move operation as long > as > 100% of all files/folders are not in use? Would be nice if the os just > wouldn't let you do the move operation at all. Like the whole operation > would > just fail. So that nothing gets moved. So 100% of the files/folders need > to > be free in order for anything to move. Can we try to rename the folder in place first? Any improbable name may be used to "disable" another process open a file after that / before moving.
"Eman" <e!m!a!n@hotmail.com> wrote in message news:ue$%23610TGHA.736@TK2MSFTNGP12.phx.gbl... > "Potion9" wrote in message > news:AD62E4C6-0258-428A-A11A-F717E919496E@microsoft.com... > > If you try to move a folder that has a file in it that is currently being > > used windows gives you an error, saying it can't be moved. What happens > > though, is that all the files in the folder that aren't being used end up > > getting moved and the one file that isn't being used ends up staying in > > its > > original location. So you get all these folders and files that are missing > > their previous neighboring files/folder. Is there a way to set windows to > > either fail if something is being used or allow the move operation as long > > as > > 100% of all files/folders are not in use? Would be nice if the os just > > wouldn't let you do the move operation at all. Like the whole operation > > would > > just fail. So that nothing gets moved. So 100% of the files/folders need > > to > > be free in order for anything to move. > > Can we try to rename the folder in place first? > Any improbable name may be used to "disable" another > process open a file after that / before moving. No, that will also fail (rename is actually MoveFile). -- -GJC [MS Windows SDK MVP] -Software Consultant (Embedded systems and Real Time Controls) - http://www.mvps.org/ArcaneIncantations/consulting.htm -gchanson@mvps.org
"Gary Chanson" wrote in message news:efVo1r2TGHA.1572@tk2msftngp13.phx.gbl... > > "Eman" <e!m!a!n@hotmail.com> wrote in message > news:ue$%23610TGHA.736@TK2MSFTNGP12.phx.gbl... >> "Potion9" wrote in message >> news:AD62E4C6-0258-428A-A11A-F717E919496E@microsoft.com... >> > If you try to move a folder that has a file in it that is currently >> > being >> > used windows gives you an error, saying it can't be moved. What happens >> > though, is that all the files in the folder that aren't being used end >> > up >> > getting moved and the one file that isn't being used ends up staying in >> > its >> > original location. So you get all these folders and files that are >> > missing >> > their previous neighboring files/folder. Is there a way to set windows >> > to >> > either fail if something is being used or allow the move operation as >> > long >> > as >> > 100% of all files/folders are not in use? Would be nice if the os just >> > wouldn't let you do the move operation at all. Like the whole operation >> > would >> > just fail. So that nothing gets moved. So 100% of the files/folders >> > need >> > to >> > be free in order for anything to move. >> >> Can we try to rename the folder in place first? >> Any improbable name may be used to "disable" another >> process open a file after that / before moving. > > No, that will also fail (rename is actually MoveFile). That's i meant, exactly ;) It seems like using MoveFile API it is the appropriate way to set windows to either fail if something is being used or allow the move operation as long as 100% of all files & folders are not in use.
"Gary Chanson" wrote in message news:uKt$n3vTGHA.1708@TK2MSFTNGP14.phx.gbl... > Actually, the move operation will fail as soon as it encounters an open > file, even if there are other files left that could be moved. > > The only way around this problem is to try to copy the files. If this > succeeds, try to delete them. If this fails, move back the files that > were > actually deleted. Moving back may be not possible if a file just moved occurs to be opened (by someone) in its new location.
"Eman" <e!m!a!n@hotmail.com> wrote in message news:exoLQM3TGHA.4436@TK2MSFTNGP10.phx.gbl... > "Gary Chanson" wrote in message > news:efVo1r2TGHA.1572@tk2msftngp13.phx.gbl... > > > > "Eman" <e!m!a!n@hotmail.com> wrote in message > > news:ue$%23610TGHA.736@TK2MSFTNGP12.phx.gbl... > >> "Potion9" wrote in message > >> news:AD62E4C6-0258-428A-A11A-F717E919496E@microsoft.com... > >> > If you try to move a folder that has a file in it that is currently > >> > being > >> > used windows gives you an error, saying it can't be moved. What happens > >> > though, is that all the files in the folder that aren't being used end > >> > up > >> > getting moved and the one file that isn't being used ends up staying in > >> > its > >> > original location. So you get all these folders and files that are > >> > missing > >> > their previous neighboring files/folder. Is there a way to set windows > >> > to > >> > either fail if something is being used or allow the move operation as > >> > long > >> > as > >> > 100% of all files/folders are not in use? Would be nice if the os just > >> > wouldn't let you do the move operation at all. Like the whole operation > >> > would > >> > just fail. So that nothing gets moved. So 100% of the files/folders > >> > need > >> > to > >> > be free in order for anything to move. > >> > >> Can we try to rename the folder in place first? > >> Any improbable name may be used to "disable" another > >> process open a file after that / before moving. > > > > No, that will also fail (rename is actually MoveFile). > > That's i meant, exactly ;) > > It seems like using MoveFile API it is the appropriate way > to set windows to either fail if something is being used > or allow the move operation as long as 100% of all files & > folders are not in use. Oh, I see. That might be an answer then. -- -GJC [MS Windows SDK MVP] -Software Consultant (Embedded systems and Real Time Controls) - http://www.mvps.org/ArcaneIncantations/consulting.htm -gchanson@mvps.org