Click here to Skip to main content
16,006,768 members
Home / Discussions / C#
   

C#

 
QuestionProblem in using namespace in c# Pin
DIPAK@EMSYS10-Aug-09 20:16
DIPAK@EMSYS10-Aug-09 20:16 
AnswerRe: Problem in using namespace in c# Pin
SeMartens10-Aug-09 20:21
SeMartens10-Aug-09 20:21 
GeneralRe: Problem in using namespace in c# Pin
DIPAK@EMSYS10-Aug-09 21:34
DIPAK@EMSYS10-Aug-09 21:34 
GeneralRe: Problem in using namespace in c# Pin
Henry Minute11-Aug-09 0:29
Henry Minute11-Aug-09 0:29 
GeneralRe: Problem in using namespace in c# Pin
DIPAK@EMSYS11-Aug-09 17:57
DIPAK@EMSYS11-Aug-09 17:57 
QuestionDateTimePicker Pin
elci10-Aug-09 20:03
elci10-Aug-09 20:03 
AnswerRe: DateTimePicker Pin
dan!sh 10-Aug-09 20:35
professional dan!sh 10-Aug-09 20:35 
QuestionHow To change the path of "user.config" Pin
shaktisinh10-Aug-09 19:25
shaktisinh10-Aug-09 19:25 
QuestionHow can I add .Net framework along with setup project Pin
Milind Panchal10-Aug-09 19:20
Milind Panchal10-Aug-09 19:20 
AnswerRe: How can I add .Net framework along with setup project Pin
dan!sh 10-Aug-09 19:24
professional dan!sh 10-Aug-09 19:24 
Questionfiltering Bulk data Pin
333soori10-Aug-09 18:53
333soori10-Aug-09 18:53 
AnswerRe: filtering Bulk data Pin
Toshiya TSURU10-Aug-09 20:09
Toshiya TSURU10-Aug-09 20:09 
QuestionWindows Installer Patch Pin
Sifar - 010-Aug-09 18:32
Sifar - 010-Aug-09 18:32 
Questionexcutable project Pin
masoudshao10-Aug-09 17:58
masoudshao10-Aug-09 17:58 
AnswerRe: excutable project Pin
dan!sh 10-Aug-09 18:26
professional dan!sh 10-Aug-09 18:26 
AnswerRe: excutable project Pin
Saksida Bojan10-Aug-09 22:27
Saksida Bojan10-Aug-09 22:27 
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 

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.