473,396 Members | 1,725 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,396 software developers and data experts.

Unlock File in C#

21
hey,

When I'm trying to delete one of my created files. My programma saids it is in use (by himself) but that's because the programma is to fast. When I let him wait 10sec the lock is gone... But that not zo good if you have to delete 20-50 files.

How can I unlock them automatically?

Thx!!!
Mar 22 '07 #1
1 7690
DiDoria
21
There are all created with:

new DirectoryInfo(Path.GetDirectoryName(path)).Create( );
StreamWriter writer = new StreamWriter(path);
writer.WriteLine(content);
writer.Close();

But than the locks are fine. But after all the files are created I zip them with "SharpZipLib" and is places locks that last realy long...

thx
Mar 22 '07 #2

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

Similar topics

0
by: John | last post by:
I've got multiple threads and processes that write to same file. Before writing all threads / processes first lock part of file and then write to file. If one thread / process locks file, another...
1
by: deko | last post by:
Is there a way to unlock a table so a subroutine can complete? frmMain!frm0 has got a lock on a table I need to do stuff with. Error Number 3211: The database engine could not lock table...
2
by: Unlock | last post by:
Greetings, Any expert able to help me to unlock the database at http://www.generate.netfirms.com/cgi-bin/to.cgi?l=res04 You will need to download the database which I have compressed into a...
4
by: accesstribe | last post by:
Folks, I have Access db, but whenever I try to open it and view design of tables, forms, etc, ie, when I double click on icon then instead of opening it in MS Access it opens as application, first...
0
by: Bohus | last post by:
I want that my thread sleeps until file is unlocked, but if I wait for signaled state of FileStream handle, it does not work and ARE.WaitOne() function returns immediately, even if file is locked...
1
by: Norman Yuan | last post by:
In my cuurent ASP.NET project, a weird thing happens: when I test-run the project and a uncatched run error occurs, VS quits the test-run, as expected. If I try to run the project again (either...
2
by: Mitch | last post by:
Would anyone have a routine kicking around that would take a users email address and convert it into a string of numbers to use as an unlock code? I am writing an application and would like it to...
3
by: m | last post by:
Hi, I'm running MySQL (5.0.18-nt) on WinXP with latest patches. I've some SQL code that generates an 'ERROR 11' in two different places depending on how the code is submitted. At the moment...
1
by: =?Utf-8?B?c3VqaXRo?= | last post by:
i created a windows service. it uses a db which attaches a mdf file. i created a installer for this service. it is installed successfully also. but the problem is while i uninstall the...
0
by: Sergei Shelukhin | last post by:
Hi. I am writing an app that updates a certain windows service that is had previously installed. It stops the service, rewrites the file, and starts it again. On some machines, however, even...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.