jana
asked on
Expanding a file size only descriptively
We need to create a series of files with over 1gb size for a project we have. We use fsutil and it works; the problem is that it affect the "free space" when querying the disk size. Is there a waye to do this?
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I had created a small C language utility back when dinosaurs roamed the earth, but the original EXE doesn't work on Windows 64-bit. It was lightening fast at allocating a large file on disk (and reserving the space) without writing real data to the file. If you have a C compiler you can compile it. Or if you want I'm happy to compile it here and get you the EXE, but I didn't want to lead with that as people can be leery of EXE's from unknown sources, as they should be.
It might be possible to duplicate the approach here in Powershell using .Net System.IO.FileStream but I haven't played around with that.
»bp
It might be possible to duplicate the approach here in Powershell using .Net System.IO.FileStream but I haven't played around with that.
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
main(int argc, char *argv[])
{
FILE *fp;
long i;
i = atol (argv[2]);
i--;
if (argc < 3)
{
printf("USAGE: ALLOCATE filename size");
exit(1);
}
if ((fp = fopen (argv[1], "wb")) == NULL)
{
perror ("Error opening output file!");
exit (1);
}
if (fseek (fp, i, SEEK_SET))
{
perror ("Error positioning output file!");
exit (1);
}
if (fputc (NULL, fp) == EOF)
{
perror ("Error writing to output file!");
exit (1);
}
if (fclose (fp) == EOF)
{
perror ("Error closing output file!");
exit (1);
}
exit (0);
}
»bp
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ah yes, good point, I had found that a while ago when needing something like this, and forgotten.
»bp
»bp
ASKER
Thank you very much for your assistance.
We chose our entry since it solved the problem.
We chose our entry since it solved the problem.
ASKER