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

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 1243
How do you delete files and how do you update the count?

Eliyahu

"Diggler" <Di*****@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.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.Threading and add in you code
Thread.Sleep(100);

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*****@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.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.GetFiles()
you should get the right result.

Eliyahu

"Diggler" <Di*****@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.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*****@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.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
PopulateDataGrid().

DeleteFiles runs first, deletes the file(s) and I changed the code in
PopulateDataGrid to read the directory using DirectoryInfo.GetFiles(). 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.GetFiles()
you should get the right result.

Eliyahu

"Diggler" <Di*****@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.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*****@discussions.microsoft.com> wrote in message
news:B0**********************************@microsof t.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*****@discussions.microsoft.com> wrote in message
news:8D**********************************@microsof t.com...
No, that didn't work. I call two different methods...

DeleteFiles() and then
PopulateDataGrid().

DeleteFiles runs first, deletes the file(s) and I changed the code in
PopulateDataGrid to read the directory using DirectoryInfo.GetFiles(). 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.GetFiles() you should get the right result.

Eliyahu

"Diggler" <Di*****@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.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*****@discussions.microsoft.com> wrote in message
> news:B0**********************************@microsof t.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*****@discussions.microsoft.com> wrote in message
news:8D**********************************@microsof t.com...
No, that didn't work. I call two different methods...

DeleteFiles() and then
PopulateDataGrid().

DeleteFiles runs first, deletes the file(s) and I changed the code in
PopulateDataGrid to read the directory using DirectoryInfo.GetFiles(). 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.GetFiles() you should get the right result.

Eliyahu

"Diggler" <Di*****@discussions.microsoft.com> wrote in message
news:1B**********************************@microsof t.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*****@discussions.microsoft.com> wrote in message
> > news:B0**********************************@microsof t.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
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...
2
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...
8
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...
3
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...
5
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 {...
6
by: shyam | last post by:
Hi All I had raised a simillar query in an earlier post ...
1
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...
8
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...
23
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.