This article has not been rated yet. After reading, feel free to leave comments and rate it.
Question::
I need to determine if a file is located on a NTFS formatted drive. There is no Windows API function for this.
Answer::
Indeed the Windows API does not provide such a function. Besides attempting to use NTFS specific functionalities and checking whether are supported - thus assuming it could be NTFS, you can create a FileSystemObject and use scripting.
The only downside of this attempt is that for security reasons scripting may be disabled on some computers.
uses
ComObj;
function IsNTFS(aFilename: string) : boolean;
var
fso,
drv: OLEvariant;
begin{ IsNTFS }
IsNTFS := False;
fso := CreateOLEObject('Scripting.FileSystemObject');
drv := fso.GetDrive(fso.GetDriveName(aFilename));
IsNTFS := drv.FileSystem='NTFS'
end; { IsNTFS }// example
if IsNTFS('f:\letter.doc') then
ShowMessage('File resides on NTFS File System')
You don't like the formatting? Check out SourceCoder then!
Comments:
2007-04-13, 09:36:32
anonymous from United Kingdom
There is a windows API call to do this
It also returns lots of other info about the partition