Peki bulunan dosyanın sadece bulunduğu klasör ismini nasıl alabilirim?
Extractfilepath ile olmuyor çünkü çıktısı ( C:\müzik\yerli ) şeklinde oluyor oysa ben sadece bulunduğu klasör adını ( yerli ) almak istiyorum.
Teşekkürler
Kullandığım kod :
Kod: Tümünü seç
procedure Klasordeki_Mp3leri_yukle(const PathName,FileName: string; const InDir: boolean );
var Rec : TSearchRec;
Path,yolu : string;
begin
Path := IncludeTrailingBackslash(PathName);
if FindFirst(Path + FileName, faAnyFile - faDirectory, Rec) = 0 then
try
repeat
yolu:=Path;
Form1.CheckListBox2.Items.AddObject(Rec.Name , TYoluItem.Create(yolu));
until FindNext(Rec) <> 0;
finally
FindClose(Rec);
end;
If not InDir then Exit;
if FindFirst(Path + '*.*', faDirectory, Rec) = 0 then
try
repeat
if ((Rec.Attr and faDirectory) <> 0) and (Rec.Name<>'.') and (Rec.Name<>'..') then
Klasordeki_Mp3leri_yukle( Path + Rec.Name, FileName, True);
until FindNext(Rec) <> 0;
finally
FindClose(Rec);
end;
end;