我从数据库里读出一大堆下面的数据
c:\Test\A1
c:\Test\B1\B11
c:\Test\C1
c:\Test\Fly.doc
c:\Test\B1\aa.txt
怎样判断是文件还是文件夹
还有怎么直接定位到c:\test文件夹下,用资源管理器方式打开。

解决方案 »

  1.   

    if DirectoryExists(s) then
      文件夹
    else
      文件当然文件夹必须存在这样的判断才有效,你最好是再建个字段标志是文件还是文件夹。直接定位到c:\test文件夹下:
    uses shellapi;ShellExecute(0, 'explore', '', '', 'c:\test', SW_NORMAL);
      

  2.   

    DWORD GetFileAttributes(    LPCTSTR lpFileName  // address of the name of a file or directory  
       );
    Return Values
    FILE_ATTRIBUTE_DIRECTORY The "file or directory" is a directory.
      

  3.   

    filegetattr(path)and fadirectory)<>fadirectory是文件
    filegetattr(path)and fadirectory)=fadirectory是文件夹