Alfaloe
asked on
determine TOTAL disk size in DOS?
1. I want to determine the TOTAL disk space for a drive, then
2. if diskspace <2 GB set x=1
if didspace >= 2 GB, set x=2
so that I can automatically format a drive (Compact Flash) <2GB as FAT16, and >=2GB as FAT32. (I know the auto-format part!)
Jeroen
PS: ONLY dos-solutions please!!!
2. if diskspace <2 GB set x=1
if didspace >= 2 GB, set x=2
so that I can automatically format a drive (Compact Flash) <2GB as FAT16, and >=2GB as FAT32. (I know the auto-format part!)
Jeroen
PS: ONLY dos-solutions please!!!
It's important to know if you are running XP/NT/2K or if you are running 9x or if you are running true DOS (6.22 for example).
Each OS has subtly (and not so subtly) different commands for some fairly important command line actions.
Each OS has subtly (and not so subtly) different commands for some fairly important command line actions.
ASKER
I'm using WinXPpro and Win2000. The CF-disks are already formatted, but I want to format them after every download of images to my PC (it prevents a lot of file-corruption, something I can't have as a pro-photographer!!)
Do you think it would be possible in an other script language, then output disk size to a txt-file, and read that line into the DOS-script?
Thanks for that quick reply!!
Do you think it would be possible in an other script language, then output disk size to a txt-file, and read that line into the DOS-script?
Thanks for that quick reply!!
Hello Alfaloe,
I'm not sure how to get the capacity of a drive, but once you have it; you could use something like this to determine what the 'x' variable as:
set capacity=[declare the capacity here]
if %capacity% LESS 2 set x=1
if %capacity% GEQ 2 set x=2
best of luck, photo guy ;-)
[r.D]
I'm not sure how to get the capacity of a drive, but once you have it; you could use something like this to determine what the 'x' variable as:
set capacity=[declare the capacity here]
if %capacity% LESS 2 set x=1
if %capacity% GEQ 2 set x=2
best of luck, photo guy ;-)
[r.D]
*Woops, "if %capacity% LESS 2 set x=1" should be:
if %capacity% LSS 2 set x=1
However, being an idiot, I don't know how to get a drives capacity :o\ Some 'expert' I am :P
Hope that helps for later! :o)
gL,
[r.D]
if %capacity% LSS 2 set x=1
However, being an idiot, I don't know how to get a drives capacity :o\ Some 'expert' I am :P
Hope that helps for later! :o)
gL,
[r.D]
Hmmmm... I've been trying to come up with something, but the numeric operators of DOS are only 4 bytes long. This creates a problem when trying to do the math necessary in comparing the the actual disk space to the limit of which format to format in.
One question - why not just format everything FAT32? The smallest "disk" you'll use is an 8 MB and I tend to think if your a professional photographer, you're using much larger drives anyway.
One question - why not just format everything FAT32? The smallest "disk" you'll use is an 8 MB and I tend to think if your a professional photographer, you're using much larger drives anyway.
ASKER
Hi Leew,
FAT32 for all drives would be too easy, wouldn't it ;-) The problem is that not all camera's can handle cards FAT32...
BUT: I think I've found a solution :
1. del all files from the card (easy using XXCOPY with /RCY switch)
2. determine free space:
@for %%a in (MyCFcard) do @if exist %%a:\ @for /F "tokens=2,3" %%b in ('dir %%a:\ /-c') do @if "%%b"=="Dir(s)" set disksize=%%c
if %disksize% LSS 2000000000 goto formatFAT
if %disksize% GEQ 2000000000 goto formatFAT32
Thanx for the suggestions!
FAT32 for all drives would be too easy, wouldn't it ;-) The problem is that not all camera's can handle cards FAT32...
BUT: I think I've found a solution :
1. del all files from the card (easy using XXCOPY with /RCY switch)
2. determine free space:
@for %%a in (MyCFcard) do @if exist %%a:\ @for /F "tokens=2,3" %%b in ('dir %%a:\ /-c') do @if "%%b"=="Dir(s)" set disksize=%%c
if %disksize% LSS 2000000000 goto formatFAT
if %disksize% GEQ 2000000000 goto formatFAT32
Thanx for the suggestions!
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Actually (that was the version I was testing to see how large a number I could work with.
ASKER
How funny Leew, when I started testing for the error you mentioned, I got exactly the OPPOSITE problem: my solution (actually s.o. else's here on EE, but I adapted it a bit) gave errors with SMALL disks (16mb, 64mb), not the 512mb, 1gb and 2gb!
Anyways, your solution WORKED beautifully, thanks, points are for you!
Jeroen
Anyways, your solution WORKED beautifully, thanks, points are for you!
Jeroen
What OS are you using?