Click here to Skip to main content
15,914,905 members
Home / Discussions / C#
   

C#

 
AnswerRe: DirectoryInfo does not return full path Pin
Alan N26-Mar-13 11:18
Alan N26-Mar-13 11:18 
Kwagga wrote:
FileInfo[] fi = di.GetFiles(sExt, SearchOption.AllDirectories);

....

Path.Combine(di.ToString(), file.ToString())


These lines may not be doing what you assume. SearchOption.AllDirectories tells GetFiles to search the starting directory and all subdirectories. The ToString() method of FileInfo's created by GetFiles returns just the filename without any path information. Your use of Path.Combine creates the correct full path only for files in the starting directory.

If your aim is to pass the full path of each file to the AddNewFile method just use the FileInfo.FullName property without Path.Combine.

i.e. AddNewFile(file.FullName);

Alan.
GeneralRe: DirectoryInfo does not return full path Pin
MumbleB2-Apr-13 9:12
MumbleB2-Apr-13 9:12 
QuestionUSB To Increase speed Pin
C-P-User-326-Mar-13 6:37
C-P-User-326-Mar-13 6:37 
QuestionRe: USB To Increase speed Pin
MicroVirus27-Mar-13 3:19
MicroVirus27-Mar-13 3:19 
QuestionType cast a enum to different enum type in the entire List; C# Pin
ptr_Electron26-Mar-13 3:47
ptr_Electron26-Mar-13 3:47 
GeneralRe: Type cast a enum to different enum type in the entire List; C# Pin
harold aptroot26-Mar-13 3:57
harold aptroot26-Mar-13 3:57 
GeneralRe: Type cast a enum to different enum type in the entire List; C# Pin
ptr_Electron26-Mar-13 5:39
ptr_Electron26-Mar-13 5:39 
AnswerRe: Type cast a enum to different enum type in the entire List; C# Pin
PIEBALDconsult26-Mar-13 5:11
mvePIEBALDconsult26-Mar-13 5:11 
GeneralRe: Type cast a enum to different enum type in the entire List; C# Pin
ptr_Electron26-Mar-13 5:40
ptr_Electron26-Mar-13 5:40 
AnswerRe: Type cast a enum to different enum type in the entire List; C# Pin
OriginalGriff26-Mar-13 6:38
mveOriginalGriff26-Mar-13 6:38 
AnswerRe: Type cast a enum to different enum type in the entire List; C# Pin
Bernhard Hiller26-Mar-13 22:29
Bernhard Hiller26-Mar-13 22:29 
QuestionHow to append connectionString from one config file to other config file Pin
NarVish26-Mar-13 1:32
NarVish26-Mar-13 1:32 
QuestionOverflow, carry, etc i C# Pin
hanzibal226-Mar-13 0:00
hanzibal226-Mar-13 0:00 
AnswerRe: Overflow, carry, etc i C# Pin
Richard MacCutchan26-Mar-13 0:08
mveRichard MacCutchan26-Mar-13 0:08 
GeneralRe: Overflow, carry, etc i C# Pin
Jonathan Nethercott26-Mar-13 0:40
professionalJonathan Nethercott26-Mar-13 0:40 
GeneralRe: Overflow, carry, etc i C# Pin
Richard MacCutchan26-Mar-13 1:03
mveRichard MacCutchan26-Mar-13 1:03 
GeneralRe: Overflow, carry, etc i C# Pin
hanzibal226-Mar-13 2:01
hanzibal226-Mar-13 2:01 
GeneralRe: Overflow, carry, etc i C# Pin
Richard MacCutchan26-Mar-13 2:10
mveRichard MacCutchan26-Mar-13 2:10 
AnswerRe: Overflow, carry, etc i C# Pin
parths26-Mar-13 21:20
parths26-Mar-13 21:20 
GeneralRe: Overflow, carry, etc i C# Pin
hanzibal226-Mar-13 22:56
hanzibal226-Mar-13 22:56 
GeneralRe: Overflow, carry, etc i C# Pin
harold aptroot26-Mar-13 23:08
harold aptroot26-Mar-13 23:08 
QuestionFile.Move/create just won't work! Pin
Goaty6510925-Mar-13 11:28
Goaty6510925-Mar-13 11:28 
AnswerRe: File.Move/create just won't work! Pin
DaveyM6925-Mar-13 11:58
professionalDaveyM6925-Mar-13 11:58 
AnswerRe: File.Move/create just won't work! Pin
Abhinav S25-Mar-13 16:47
Abhinav S25-Mar-13 16:47 
AnswerRe: File.Move/create just won't work! Pin
Richard MacCutchan26-Mar-13 0:02
mveRichard MacCutchan26-Mar-13 0:02 

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.