473,322 Members | 1,494 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

C#: Wait till a file is free for renaming

Hi,

I need to rename a file. But it is been opened by another program, so i cannot rename it. Does anybody know how to wait till that file is inaccessed or free from that program?

Thanks in advance,
Chang.
Jun 1 '08 #1
3 1886
kenobewan
4,871 Expert 4TB
Hi,

I need to rename a file. But it is been opened by another program, so i cannot rename it. Does anybody know how to wait till that file is inaccessed or free from that program?

Thanks in advance,
Chang.
Gee you could be waiting a long time, have you tried using threads?
Jun 1 '08 #2
Gee you could be waiting a long time, have you tried using threads?
I didnt get a logic to what to wait for if even using a thread. I tried FileSystemWatcher but it didnt help though. It just throws event if any change happens but not look whether it is been used by any other process.
Jun 1 '08 #3
kenobewan
4,871 Expert 4TB
I didnt get a logic to what to wait for if even using a thread. I tried FileSystemWatcher but it didnt help though. It just throws event if any change happens but not look whether it is been used by any other process.
I was thinking your code tries to execute a rename, then you treat this process as a thread. Try searching the site as the topic of locked files has come up before.
Jun 2 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: M P | last post by:
Can you help me find an asp code that will upload a file from my PC to web server? Mark
7
by: DaVBGuy | last post by:
I'm currently using VB 6 for windows based apps. Should I make the jump to VS.2003 now, or should I wait till (the final) VS.2005 release comes out later this year. If I have not started...
3
by: HooHa | last post by:
I am writing a program that has a portion which downloads files into a selected directory. It first checks to see if the file exists if the file exists it opens another form with buttons related...
1
by: Susan | last post by:
I am trying to amend someone else's code. He had a user control pop up as modal so that the user can not access the main app till he is done with the user control. I have had to change the form...
6
by: SP | last post by:
Hi, I want to add wait cursor code whenever page is post back. Page may be post back on my user control's or on change of dropdown or on click of any button on page. so is there any common...
0
by: | last post by:
In my application I wait for a shelled application to finish and continue to work. Everything works fine but when the shelled program is up and user tries to open other applications (outside of...
18
by: Coder | last post by:
Howdy everybody! How do I do the following... while (myVary != true){}; Obviously I do not want to use 100% of the processor to stay in this infinite loop till myVar == true. But wait do I...
4
by: paul | last post by:
A client appears to have either completely corrupted their .mdb file or has somehow managed to create a .bak file whilst trying to zip the .mdb file. Can anyone advise how I might be able to...
5
by: chenthil | last post by:
In my Java program I need to call two DOS batch programs namely call.bat and start.bat. First I need to start the batch program call.bat and once that program is completed, I need to call the other...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.