Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: Thu, 23 Mar 2006 12:49:31 -0800,    group: microsoft.public.win32.programmer.tools        back       


Moving file/folders while in use.   
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.
date: Thu, 23 Mar 2006 12:49:31 -0800   author:   Potion9

Re: Moving file/folders while in use.   
"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
date: Thu, 23 Mar 2006 23:44:12 -0500   author:   Gary Chanson

Re: Moving file/folders while in use.   
"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.
date: Fri, 24 Mar 2006 17:14:51 +0300   author:   Eman e!m!a!

Re: Moving file/folders while in use.   
"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
date: Fri, 24 Mar 2006 12:46:30 -0500   author:   Gary Chanson

Re: Moving file/folders while in use.   
"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.
date: Fri, 24 Mar 2006 21:42:14 +0300   author:   Eman e!m!a!

Re: Moving file/folders while 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.
date: Fri, 24 Mar 2006 21:42:59 +0300   author:   Eman e!m!a!

Re: Moving file/folders while in use.   
"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
date: Fri, 24 Mar 2006 18:13:21 -0500   author:   Gary Chanson

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us