I'm french so sorry for my little language...
So, my project is here Memo and create file and folder?
i have a problem with my code :
var
path: String;
F: TextFile;
i, e: Integer;
begin
for i := 0 to Memo1.Lines.Count - 1 do
begin
if Length(Memo1.Lines[i]) > 0 then
begin
if Memo1.Lines[i][1] = '\' then // first character for file
if Pos('.', Memo1.Lines[i]) > 0 then // confirm file
begin
path := extractfilepath(Edit1.Text) + Memo1.Lines[i];
// showmessage(path);
if not FileExists(path) then
begin
AssignFile(F, path);
Rewrite(F);
CloseFile(F);
end;
end;
e := Length(Memo1.Lines[i]);
case Memo1.Lines[i][e] of // last character for folder
'\':
begin
path := extractfilepath(Edit1.Text) + Memo1.Lines[i];
if not DirectoryExists(path) then
ForceDirectories(path); // create folder
end;
end;
end;
end;
end;
my structure in Tmemo is :
and my bad result:
i test first and last character for know what is it file or folder and my problem is file saved in currentPath, no in folder1:
Dir:
folder1->file1.txt
folder2 ->file2.txt and file2-3.txt
etc..
can you help me please?
Thanks a lot.