gudidi
asked on
programming delete folder problem - lock by process
Hi Experts
i am trying to rename a folder from C#.
i get an error:
The process cannot access the file because it is being used by another process. System.IO.IOException
i can't find out which process lock the folder.
i tried to use OpenedFilesView but it not indicate folder locking.
can someone help?
10x
i am trying to rename a folder from C#.
i get an error:
The process cannot access the file because it is being used by another process. System.IO.IOException
i can't find out which process lock the folder.
i tried to use OpenedFilesView but it not indicate folder locking.
can someone help?
10x
ASKER
is there a program that i can use just to know who holds the folder? without kill it?
@gudidi
How are you trying to rename the File?
How are you trying to rename the File?
ASKER
hi
with this command:
Directory.Move(sSilviPath + "\\Components", sSilviPath + "\\Components_Old");
10x
with this command:
Directory.Move(sSilviPath + "\\Components", sSilviPath + "\\Components_Old");
10x
not sure if the @ sign is needed File.Move(@"C:\MyFile.txt" , @"C:\MyNewerFile.txt");
ASKER
While i stop the process with sleep command i can NOT change manually the folder name.
but i stop the processes i can cahnge it.
so, i would like to know how to find which process locks me?
10x
but i stop the processes i can cahnge it.
so, i would like to know how to find which process locks me?
10x
gudidi:
You found the process that is using one File or the directoryInfo ! Your program is using it!
Are you somewhere creating a file or writing to a file in the Directory? => Close the stream!
Have you created a DirectoryInfo Object for that Folder? ==> Dispose of that object !
Have you created a FileInfo Object for a file in that folder? ==> Dispose of that object !
Are you running your program from that folder? ==> I'm sorry but you can't change the workingfolders name while running the program inside it
regards
poor beggar
You found the process that is using one File or the directoryInfo ! Your program is using it!
Are you somewhere creating a file or writing to a file in the Directory? => Close the stream!
Have you created a DirectoryInfo Object for that Folder? ==> Dispose of that object !
Have you created a FileInfo Object for a file in that folder? ==> Dispose of that object !
Are you running your program from that folder? ==> I'm sorry but you can't change the workingfolders name while running the program inside it
regards
poor beggar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
you can kill all process with it that are locking.