TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
ariez
NA
34
0
FileSystemwatcher
Jun 30 2010 5:41 AM
m using FileSystemWatcher, i want to get the size of a file present in my folder. whereas i can find the size of whole folder but not of a file inside that folder. m using fileinfo.lenght to get the size of the file, for this fileinfo.exists property should be true but it is false i dont knw y? even if file already exists.
m using Filesystemwatcher in windows application where as my main application is a web based(ASP.NET). now what i want to achieve is that whenever user creates a new file or copy the existing file in that folder, the application should get the size of the newly created file or copied file and check with the remaining space of that folder because user is given only a limited space (letsay 1 or 2 GB)
eg when u save anything in ur PC the space of the hard disk is decreased. i want to do exactly the same thing that when user creates any file and wishes to save it ,at that time the space must be checked.
people with brains plz come fwd to help me in this regard...THANX
private void filewatcher_Changed(object sender, FileSystemEventArgs e)
{
string path = e.FullPath;
int index = path.LastIndexOf("\\");
string filename = path.Substring(index + 1);
FileInfo fi = new FileInfo(filename);
string a=filename.Length.ToString();
txtLog.Text += e.ChangeType + ": " + e.FullPath + "\r\n";
txtLog.Focus();
txtLog.Select(txtLog.TextLength, 0);
txtLog.ScrollToCaret();
}
private void Monitor_button (object sender, EventArgs e)
{
fileWatcher.Path = @txtPath.Text;
fileWatcher.Filter = txtFilter.Text;
fileWatcher.IncludeSubdirectories = chkSubdirectories.Checked;
fileWatcher.EnableRaisingEvents = true;
}
Reply
Answers (
0
)
Dynamic datagrid based on periods and categories
Generating typed dataset from XSD