Click here to Skip to main content
15,895,922 members
Home / Discussions / C#
   

C#

 
AnswerRe: excutable project Pin
senguptaamlan10-Aug-09 22:43
senguptaamlan10-Aug-09 22:43 
QuestionXml Problem Pin
Saksida Bojan10-Aug-09 10:11
Saksida Bojan10-Aug-09 10:11 
AnswerRe: Xml Problem Pin
Ennis Ray Lynch, Jr.10-Aug-09 10:44
Ennis Ray Lynch, Jr.10-Aug-09 10:44 
GeneralRe: Xml Problem Pin
Saksida Bojan10-Aug-09 10:48
Saksida Bojan10-Aug-09 10:48 
GeneralRe: Xml Problem Pin
harold aptroot10-Aug-09 11:10
harold aptroot10-Aug-09 11:10 
AnswerRe: Xml Problem Pin
PIEBALDconsult10-Aug-09 11:32
mvePIEBALDconsult10-Aug-09 11:32 
GeneralRe: [Solved] Xml Problem [modified] Pin
Saksida Bojan10-Aug-09 19:45
Saksida Bojan10-Aug-09 19:45 
QuestionTrying to Copy a changed file to backup folder Pin
Luke Perrin10-Aug-09 9:59
Luke Perrin10-Aug-09 9:59 
Hi All!
I want to use this code to copy a changed file to backup folder, i am using
Filesystemwatcher to listen for the change to a file in a test folder in documents, and when a file is changed a copy should end up in backup.

Now when i use File.Copy it copies the file but then gives me an exception saying it allready exists! How can this be when the backup folder was empty?! i checked this out, and if i use File.Move it still complains when it moves the folder to backup, and the says "file does not exist in test!" so copy would be better as it leaves the original where it is, but why the hell does it say it allready exists in backup when it copies it over?? any ideas? im doin the 70-536 course and the "suggested practices" at the end of the chapters just chuck you in the deep end! lol.


//set the FileSystemWatcher properties
fsd.IncludeSubdirectories = true;
fsd.Path = @"C:\Users\Luke\Documents\test";
fsd.NotifyFilter = NotifyFilters.FileName | NotifyFilters.LastWrite;

//add the changed event handler
fsd.Changed += new FileSystemEventHandler(fsd_Changed);
fsd.EnableRaisingEvents = true;

static void fsd_Changed(object sender, FileSystemEventArgs e)
{

//allready exists on first copy!!??
File.Copy(@"C:\Users\Luke\Documents\test\" + e.Name,
@"C:\Users\Luke\Documents\test\Backup\" + "bak" + e.Name);

//moves file and then says "could not find file in test!
File.Move(@"C:\Users\Luke\Documents\test\" + e.Name,
@"C:\Users\Luke\Documents\test\Backup\" + "bak" + e.Name);
}




















AnswerRe: Trying to Copy a changed file to backup folder Pin
DaveyM6910-Aug-09 10:27
professionalDaveyM6910-Aug-09 10:27 
QuestionHow to run C# AND VB.NET applications together? Pin
CoderForEver10-Aug-09 9:30
CoderForEver10-Aug-09 9:30 
AnswerRe: How to run C# AND VB.NET applications together? Pin
Leonardo Muzzi10-Aug-09 9:53
Leonardo Muzzi10-Aug-09 9:53 
GeneralRe: How to run C# AND VB.NET applications together? Pin
CoderForEver10-Aug-09 10:04
CoderForEver10-Aug-09 10:04 
GeneralRe: How to run C# AND VB.NET applications together? Pin
Leonardo Muzzi10-Aug-09 10:16
Leonardo Muzzi10-Aug-09 10:16 
GeneralRe: How to run C# AND VB.NET applications together? Pin
CoderForEver10-Aug-09 22:41
CoderForEver10-Aug-09 22:41 
GeneralRe: How to run C# AND VB.NET applications together? Pin
Not Active10-Aug-09 11:51
mentorNot Active10-Aug-09 11:51 
GeneralRe: How to run C# AND VB.NET applications together? Pin
CoderForEver10-Aug-09 22:53
CoderForEver10-Aug-09 22:53 
QuestionRead traffic from router Pin
tamir90110-Aug-09 7:02
tamir90110-Aug-09 7:02 
Answersorry...SUBJECT CHANGED Pin
CoderForEver10-Aug-09 9:34
CoderForEver10-Aug-09 9:34 
GeneralRe: sorry...SUBJECT CHANGED Pin
stancrm10-Aug-09 11:09
stancrm10-Aug-09 11:09 
AnswerRe: Read traffic from router Pin
stancrm10-Aug-09 11:07
stancrm10-Aug-09 11:07 
QuestionHandling with multiple SQL-DataReader Pin
softwarejaeger10-Aug-09 6:45
softwarejaeger10-Aug-09 6:45 
AnswerRe: Handling with multiple SQL-DataReader Pin
Ennis Ray Lynch, Jr.10-Aug-09 6:55
Ennis Ray Lynch, Jr.10-Aug-09 6:55 
GeneralRe: Handling with multiple SQL-DataReader Pin
PIEBALDconsult10-Aug-09 7:03
mvePIEBALDconsult10-Aug-09 7:03 
AnswerRe: Handling with multiple SQL-DataReader Pin
PIEBALDconsult10-Aug-09 6:55
mvePIEBALDconsult10-Aug-09 6:55 
GeneralRe: Handling with multiple SQL-DataReader Pin
softwarejaeger10-Aug-09 7:20
softwarejaeger10-Aug-09 7:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.