J.R., I found the code. It is in Java. I am attaching it here. You can use any java IDE to run it. You will need to change the drive letter defined in the line below to the drive that maps your memory card.
FillDiskSpace fds1 = new FillDiskSpace("D:");
can be changed to:
FillDiskSpace fds1 = new FillDiskSpace("G:");
if your drive G is the memory card. The program creates a folder called Dir2Fill and fills it with 1MB files containing junk. So delete everything on the card. Run the program. Once it fills up, you can delete that folder and you should be ok. In case you are paranoid about the 1MB, change the line:
private static final int ONE_MB = 1048576;
to:
private static final int ONE_MB = 1024;
and you will be fine.
Code follows:
//==Code follows: ======================================
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
public class FillDiskSpace {
private static final String DIR_NAME = "Dir2Fill";
private static final String FILE_LINE = "AAAAAAAAAASSSSSSSSSSDDDDDDDDDDFFFFFFFFFFGGGGGGGGGGHHHHHHHHHHJJ\r\n";
private static final String C_DRIVE = "C:";
private static final int ONE_MB = 1048576;
private static final int SIXTY_FOUR = 64;
private static final String DRV_STR_LENGTH = "Drive string must be 2 characters long.";
private static final String DRV_STR_NO_COLON = "The character at the second position must be a colon ':'";
private static final String INVALID_DRV_LTR = "Invalid drive letter. Must be between 'A' and 'Z' inclusive.";
private String sDrive = null;
private String sDirFullPath = null;
public FillDiskSpace()
{
FillDiskSpaceMthd(C_DRIVE);
}
private void FillDiskSpaceMthd(String sDir)
{
String sErrMsg = null;
sDir = sDir.toUpperCase();
if(sDir.length() != 2)
sErrMsg = DRV_STR_LENGTH;
else if(sDir.charAt(1) != ':')
sErrMsg = DRV_STR_NO_COLON;
else if(sDir.charAt(0) < 'A' || sDir.charAt(0) > 'Z')
sErrMsg = INVALID_DRV_LTR;
if(sErrMsg != null)
{
System.out.println(sErrMsg);
return;
}
long lStart = System.currentTimeMillis()/1000l;
long lThen = lStart;
long lNow = lStart;
long lDiffSec = 0;
long lDiffSecTotal = 0;
sDrive = sDir;
sDirFullPath = sDrive + "/" + DIR_NAME;
File dir = new File(sDirFullPath);
dir.mkdir();
int ret = 0;
int fileNo = 1;
while(ret == 0)
{
String sFileName = "File_" + fileNo + ".txt";
ret = WriteA1MbFile(sFileName);
if( fileNo%100 == 0)
{
lNow = System.currentTimeMillis()/1000l;
lDiffSec = (lNow - lThen);
lThen = lNow;
lDiffSecTotal = (lNow - lStart);
System.out.println("Wrote " + fileNo + " files so far... This set took " + lDiffSec + " sec. Total so far " + lDiffSecTotal + " sec.");
}
if(ret == 0)
fileNo++;
}
lNow = System.currentTimeMillis()/1000l;
lDiffSec = (lNow - lThen);
System.out.println("\r\nWrote " + (ret==-1?fileNo:fileNo-1) + " files in all. This set took " + lDiffSec + " sec.");
lDiffSec = (lNow - lStart);
System.out.println("Total time taken is " + lDiffSec + " sec.");
}
public FillDiskSpace(String sDir)
{
FillDiskSpaceMthd(sDir);
}
/**
* @param args
*/
public static void main(String[] args)
{
FillDiskSpace fds1 = new FillDiskSpace("D:");
}
private int WriteA1MbFile(String sFileName)
{
String content = FILE_LINE;
int siz = 0;
try {
File file = new File(sDirFullPath + "/" + sFileName);
// if file doesnt exists, then create it
if (!file.exists()) {
file.createNewFile();
}
FileWriter fw = new FileWriter(file.getAbsoluteFile());
BufferedWriter bw = new BufferedWriter(fw);
while( siz < ONE_MB)
{
bw.write(content);
siz += SIXTY_FOUR;
}
bw.close();
} catch (IOException e) {
// e.printStackTrace();
System.out.println(e.getMessage());
return (siz == 0? -2:-1);
}
return 0;
}
}
//==Code ends: =======================================