473,785 Members | 2,209 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Waiting for a file deletion to continue

I have a web application that allows a user to manage files on the server.
On the page is a counter that tells them how many files are in their folder.
When you delete a file from the folder using ASP.NET, it seems to send a
command off to delete the file and keeps processing the page... the page
reloads, but the file count of the folder doesn't change because it seems
that the page rendering is faster than the file deletion.

Is there any way to get around this?
Nov 18 '05 #1
7 1261
How do you delete files and how do you update the count?

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:B0******** *************** ***********@mic rosoft.com...
I have a web application that allows a user to manage files on the server.
On the page is a counter that tells them how many files are in their folder. When you delete a file from the folder using ASP.NET, it seems to send a
command off to delete the file and keeps processing the page... the page
reloads, but the file count of the folder doesn't change because it seems
that the page rendering is faster than the file deletion.

Is there any way to get around this?

Nov 18 '05 #2
hi
try to make sleep thread for a little time before deleting the file.
include System.Threadin g and add in you code
Thread.Sleep(10 0);

Or Just keep in viewstate the last number of files before delete and just
decrement with 1 your file number.

Cheers

"Diggler" wrote:
I have a web application that allows a user to manage files on the server.
On the page is a counter that tells them how many files are in their folder.
When you delete a file from the folder using ASP.NET, it seems to send a
command off to delete the file and keeps processing the page... the page
reloads, but the file count of the folder doesn't change because it seems
that the page rendering is faster than the file deletion.

Is there any way to get around this?

Nov 18 '05 #3
I use the FileInfo object to delete the file, they are all stored in a
FileInfo[] array.

I get the count by using the IMessages interface, since these are email
messages and I have to read the headers for each file... so I use the
IMessages.Count property.

"Eliyahu Goldin" wrote:
How do you delete files and how do you update the count?

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:B0******** *************** ***********@mic rosoft.com...
I have a web application that allows a user to manage files on the server.
On the page is a counter that tells them how many files are in their

folder.
When you delete a file from the folder using ASP.NET, it seems to send a
command off to delete the file and keeps processing the page... the page
reloads, but the file count of the folder doesn't change because it seems
that the page rendering is faster than the file deletion.

Is there any way to get around this?


Nov 18 '05 #4
Deleting with FileInfo is fine, it should delete file immediatly. I am not
familiar with IMessages. If you use something like DirectoryInfo.G etFiles()
you should get the right result.

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
I use the FileInfo object to delete the file, they are all stored in a
FileInfo[] array.

I get the count by using the IMessages interface, since these are email
messages and I have to read the headers for each file... so I use the
IMessages.Count property.

"Eliyahu Goldin" wrote:
How do you delete files and how do you update the count?

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:B0******** *************** ***********@mic rosoft.com...
I have a web application that allows a user to manage files on the server. On the page is a counter that tells them how many files are in their

folder.
When you delete a file from the folder using ASP.NET, it seems to send a command off to delete the file and keeps processing the page... the page reloads, but the file count of the folder doesn't change because it seems that the page rendering is faster than the file deletion.

Is there any way to get around this?


Nov 18 '05 #5
No, that didn't work. I call two different methods...

DeleteFiles() and then
PopulateDataGri d().

DeleteFiles runs first, deletes the file(s) and I changed the code in
PopulateDataGri d to read the directory using DirectoryInfo.G etFiles(). I
think the code is running faster than the delete.

"Eliyahu Goldin" wrote:
Deleting with FileInfo is fine, it should delete file immediatly. I am not
familiar with IMessages. If you use something like DirectoryInfo.G etFiles()
you should get the right result.

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
I use the FileInfo object to delete the file, they are all stored in a
FileInfo[] array.

I get the count by using the IMessages interface, since these are email
messages and I have to read the headers for each file... so I use the
IMessages.Count property.

"Eliyahu Goldin" wrote:
How do you delete files and how do you update the count?

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:B0******** *************** ***********@mic rosoft.com...
> I have a web application that allows a user to manage files on the server. > On the page is a counter that tells them how many files are in their
folder.
> When you delete a file from the folder using ASP.NET, it seems to send a > command off to delete the file and keeps processing the page... the page > reloads, but the file count of the folder doesn't change because it seems > that the page rendering is faster than the file deletion.
>
> Is there any way to get around this?


Nov 18 '05 #6
Very strange. Are you sure the delete works in the first place?

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:8D******** *************** ***********@mic rosoft.com...
No, that didn't work. I call two different methods...

DeleteFiles() and then
PopulateDataGri d().

DeleteFiles runs first, deletes the file(s) and I changed the code in
PopulateDataGri d to read the directory using DirectoryInfo.G etFiles(). I
think the code is running faster than the delete.

"Eliyahu Goldin" wrote:
Deleting with FileInfo is fine, it should delete file immediatly. I am not familiar with IMessages. If you use something like DirectoryInfo.G etFiles() you should get the right result.

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
I use the FileInfo object to delete the file, they are all stored in a
FileInfo[] array.

I get the count by using the IMessages interface, since these are email messages and I have to read the headers for each file... so I use the
IMessages.Count property.

"Eliyahu Goldin" wrote:

> How do you delete files and how do you update the count?
>
> Eliyahu
>
> "Diggler" <Di*****@discus sions.microsoft .com> wrote in message
> news:B0******** *************** ***********@mic rosoft.com...
> > I have a web application that allows a user to manage files on the

server.
> > On the page is a counter that tells them how many files are in their > folder.
> > When you delete a file from the folder using ASP.NET, it seems to

send a
> > command off to delete the file and keeps processing the page...
the page
> > reloads, but the file count of the folder doesn't change because
it seems
> > that the page rendering is faster than the file deletion.
> >
> > Is there any way to get around this?
>
>
>


Nov 18 '05 #7
I am abolutely sure. I keep the folder containing the file open while
deleting, and watch the file disappear. The page usually displays before the
file disappears. I theorize that the framework sends a message to the
operating system to 'delete this file' then returns immediately, allowing the
OS to take care of the actual delete.

"Eliyahu Goldin" wrote:
Very strange. Are you sure the delete works in the first place?

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:8D******** *************** ***********@mic rosoft.com...
No, that didn't work. I call two different methods...

DeleteFiles() and then
PopulateDataGri d().

DeleteFiles runs first, deletes the file(s) and I changed the code in
PopulateDataGri d to read the directory using DirectoryInfo.G etFiles(). I
think the code is running faster than the delete.

"Eliyahu Goldin" wrote:
Deleting with FileInfo is fine, it should delete file immediatly. I am not familiar with IMessages. If you use something like DirectoryInfo.G etFiles() you should get the right result.

Eliyahu

"Diggler" <Di*****@discus sions.microsoft .com> wrote in message
news:1B******** *************** ***********@mic rosoft.com...
> I use the FileInfo object to delete the file, they are all stored in a
> FileInfo[] array.
>
> I get the count by using the IMessages interface, since these are email > messages and I have to read the headers for each file... so I use the
> IMessages.Count property.
>
> "Eliyahu Goldin" wrote:
>
> > How do you delete files and how do you update the count?
> >
> > Eliyahu
> >
> > "Diggler" <Di*****@discus sions.microsoft .com> wrote in message
> > news:B0******** *************** ***********@mic rosoft.com...
> > > I have a web application that allows a user to manage files on the
server.
> > > On the page is a counter that tells them how many files are in their > > folder.
> > > When you delete a file from the folder using ASP.NET, it seems to
send a
> > > command off to delete the file and keeps processing the page... the page
> > > reloads, but the file count of the folder doesn't change because it seems
> > > that the page rendering is faster than the file deletion.
> > >
> > > Is there any way to get around this?
> >
> >
> >


Nov 18 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1851
by: Justin | last post by:
Hi all, Does anybody know a way, in VB.Net, I can discover the file locks on a file on the local machine. I have an application which needs to delete specific files, but I would like to verify in advance whether or not a particular deletion will succeed. Due to other pre-deletion actions, I cannot attempt the deletion and catch the exception if it fails. Thanks in advance
2
15994
by: kelly | last post by:
Hi, I don't have a code to show you, what I need are references or algorithms so that I'm in a right track. By the way, thanks for introducing me the array or arrays. Now I can continue my script. Now I want to delete a line from a file. Line being the strings I got/saved to/from array of arrays.
8
3519
by: Andrew Robert | last post by:
Hi Everyone. I tried the following to get input into optionparser from either a file or command line. The code below detects the passed file argument and prints the file contents but the individual swithces do not get passed to option parser.
3
1681
by: A_Republican | last post by:
I am interested in writing my own secure file deletion program. I want to be able to read and write to my hard drive directly. My application will seach my hard drive for all locations marked for deletion and then replace it with "x" or something that securely removes previoius data. My question is what objects, API calls, etc, etc do I use to read and write directly to the hard drive? -- Regards, Shaun Goldston
5
4436
by: Hansen | last post by:
Hi! I have a problem with an object not yet being initialized when I try to access it. Hence I would like to wait for the object to be initialized. I have the following code: try { if(gridArray == null) {
6
2056
by: shyam | last post by:
Hi All I had raised a simillar query in an earlier post http://groups.google.com/group/comp.lang.c++/browse_thread/thread/f371af248d90ead6/1d054627402539e1?lnk=gst&q=ofstream+write+failure&rnum=1#1d054627402539e1 Basically I have a file which is opened through ofstream for writing. Now I want to check if the file has been deleted or not, while being in
1
2501
by: pamela fluente | last post by:
Is there an option to avoid the deletion of the entire site when doing the deployment (Publish feature) ? Why on the heart it has to erase *everything* by default? This seems absurd! If am I publishing my site I do not see why it has to delete all the other folders of my site, containing other stuff !!?? Why do not just replace the old files ?
8
2216
by: Horacius ReX | last post by:
Hi, I need to write a program which reads an external text file. Each time it reads, then it needs to delete some lines, for instance from second line to 55th line. The file is really big, so what do you think is the fastest method to delete specific lines in a text file ? Thanks
23
13787
by: canabatz | last post by:
can someone please help me set up a loop to wait for a file to be exist? i got a automation program that download a file from my ftp ,proccessing the file and returning back the result as a file! what im doing right now is im puting a sleep(15); to the executed file in my site to wait for the file!! ,the problem is that the proccesing of the file can take 1 second some time ,and some time 3 seconds, i put 15 seconds to be sure the file...
0
9483
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10157
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10096
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9956
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8982
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4055
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.