jeurk
asked on
Check if removable drive is empty or not
Hi,
I have a jazz drive.
How can i check if it is empty or not ?
It's a removable drive.
Your solution should work, under 95 and NT
Thanks
I have a jazz drive.
How can i check if it is empty or not ?
It's a removable drive.
Your solution should work, under 95 and NT
Thanks
I would put it inside a try / except / end just to make sure about exception if there is no drive or is the drive is not formatted (or corrupted).
JDB
JDB
Hi all,
What if the disk is empty (but in the driver) ? I think FileExists will return false.
Perhaps a better solution could be:
Drive := 1 // 0 = Current, 1 = A, 2 = B, etc.
if DiskSize(Drive)>0 then
begin
Label1.Caption := '(disk in drive)'
end
else
begin
Label1.Caption := '(no disk in drive or disk not formatted)'
end;
IHTH,
Itamar
What if the disk is empty (but in the driver) ? I think FileExists will return false.
Perhaps a better solution could be:
Drive := 1 // 0 = Current, 1 = A, 2 = B, etc.
if DiskSize(Drive)>0 then
begin
Label1.Caption := '(disk in drive)'
end
else
begin
Label1.Caption := '(no disk in drive or disk not formatted)'
end;
IHTH,
Itamar
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hummm,
I see that pjdb took my comment, elaborate it a little and placed as an answer .....
Not a very good conduct....
Let's hear smth from jeurk.
And just another what if...
What if the disk is unformatted. The proposed function (and my comment itself) will give a result of false, what is not absolutely right. The drive is not fisically empty.
Perhaps it is critical to jeurk's usage, so let's hear from him.
Bye,
Itamar
I see that pjdb took my comment, elaborate it a little and placed as an answer .....
Not a very good conduct....
Let's hear smth from jeurk.
And just another what if...
What if the disk is unformatted. The proposed function (and my comment itself) will give a result of false, what is not absolutely right. The drive is not fisically empty.
Perhaps it is critical to jeurk's usage, so let's hear from him.
Bye,
Itamar
ASKER
Like I sayd in the other thread I'll check the things out.
About the unformatted thing, itamar, I does not really matter,
but for sure if you know how to detect if the drive is unformatted
You will earn some points;
Jeurk
About the unformatted thing, itamar, I does not really matter,
but for sure if you know how to detect if the drive is unformatted
You will earn some points;
Jeurk
Sorry itamar to have token your answer but i've post only 2 minutes after you. In fact when i've load the page there was no answer (i was probably seeking my code when you post it). Moreover, your code does not work under NT (it raise an error on floppies).
Jeurk can evaluate know will have points (i wont send any more message on this thread)
JDB
Jeurk can evaluate know will have points (i wont send any more message on this thread)
JDB
ASKER
Hi,
Let's say I'll give those points out, so that we close the thead.
Sorry itamar, but u won't get a point for that question.
What can I say ? It's true that your answer is near of pjdb's,
but it's true that it raises an error under NT.
Don't take it personnel, please.
I you don't like that, let me know and I'll make a thead just for you
and I'll grant you 50 points too. I don't wan you to be sad about that, ok ?
Jeurk.
Let's say I'll give those points out, so that we close the thead.
Sorry itamar, but u won't get a point for that question.
What can I say ? It's true that your answer is near of pjdb's,
but it's true that it raises an error under NT.
Don't take it personnel, please.
I you don't like that, let me know and I'll make a thead just for you
and I'll grant you 50 points too. I don't wan you to be sad about that, ok ?
Jeurk.
if FileExists('a:\*.*') then
begin
(disk in drive)
end
else
begin
(no disk in drive or disk not formatted)
end;
Socrates