String path="c://aa/temp.txt";
File f2=new File(path);
File aa=f2.getParentFile();
aa.mkdirs();
f2.createNewFile();
File f2=new File(path);
File aa=f2.getParentFile();
aa.mkdirs();
f2.createNewFile();
var
path:string;
filename:string;
begin
path:=ExtractFilePath(Application.ExeName)+'report\'+edit1.Text;
filename:=edit1.Text;
if searchfolder(filename) then
begin
showmessage('该文件夹已经存在');
end
else
begin
showmessage('文件夹不存在');
ForceDirectories(path);
end;end;
function Tform1.searchfolder(var foldername:string):boolean;
var
path:string;
sr: TSearchRec;
begin
path:=ExtractFilePath(Application.ExeName)+'report\'+foldername;
if FindFirst(path, faAnyFile, sr) = 0 then
begin
if ((sr.Attr and fadirectory) = fadirectory) and (sr.Name<>'.') and (sr.Name<>'..') then
begin
result:=true;
end;
end //first
else
result:=false;
FindClose(SR);
end;
if(!passFile.exists())
{
passFile.mkdir();
}
passFile=new File("c:\\winnt\\file.txt");楼主顺便问一句String path="c://aa/temp.txt";
你用的不是WINDOWS?这个路径是在WINDOWS下的话,如何能通过?