Click here to Skip to main content
15,917,061 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

My question is "How do you delete a file on specified date and time using ASP.Net." Could you help me to over come this problem?

[EDIT]Don't ask for "codez" - it annoys people because it make you look too lazy to do anything yourself/EDIT]
Posted
Updated 31-Jan-11 21:56pm
v3
Comments
Venkatesh Mookkan 1-Feb-11 3:49am    
Post what you done so far and tell where you are struck.
m@dhu 1-Feb-11 3:54am    
Don't use text-speak while you post the questions.

There is open source framework Quartz.net which allows to execute some code on specified time. It works as scheduler for .NET application. And more than that, it is a very lightweight framework. You can make use of it in small to large scale applications.

You can find a very good tutorial on it at
http://quartznet.sourceforge.net/tutorial/index.html[^]

Get it downloaded at
http://sourceforge.net/projects/quartznet/files/[^]

I hope this helps you.
All the best.
 
Share this answer
 
Comments
sam, atlanta 1-Feb-11 5:24am    
Good links for Quartz.Net...
You can develop a windows service which runs on server and deletes the old files or the particular file on a particular date. You can't do it with "automatically" with web application.
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 1-Feb-11 3:57am    
I think the question is more easy. Look at the level of question: do you think OP could afford making a service? -- please see my answer.
--SA
Prerak Patel 1-Feb-11 4:11am    
But I see a chance that he is asking to automate a regular task of cleaning disk space by deleting those files which have expired. I used to do that before, that's why I suggested him the windows service approach.
Sergey Alexandrovich Kryukov 1-Feb-11 4:15am    
Let's see, why all that guesswork?
--SA
No. Nobody helps you until you explain: Is it 1) moment of time you want to delete file? 2) file time (creation, last access...), i.e. file attribute.

In first case, use current DataTime and timer. In second case, traverse files by start directory/mask (System.IO.Directory.GetFiles) with the predicate which reads file attributes and returns predicate value; obtain the set of files and do your deletion. All you need is System.IO.

Please find all the API yourself; it's way too easy, and you did not show any code to attempt the solution; my directions should be enough.

Thank you for understanding.

—SA
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 1-Feb-11 12:27pm    
The vote of "1" for this answer is a bright manifestation of the activism of an international party "laziness beyond boundaries". Give me the code! I don't want to do anything! Congratulations, you looser!
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900