CopyFile is failing after some time ???



Hi…
In my Win mobile 5.0 based application, I have to fill the SD card (say it’s
1 GB card) with a large number of small files (say 50 KB size file). I am
using CopyFile() API here in a loop.
I am changing the name of the file in each iteration (say file name is
SmallFile.doc, in next CopyFile() execution file name will be SmallFile1.doc).
Now the problem occurring here that after an unexpected iteration,
CopyFile() is throwing error as ERROR_DISK_FULL and coming out from the loop,
though enough memory is still free. According to MSDN “To store the maximum
number of files on PC Card storage devices, limit file names to eight
uppercase characters and file extensions to three uppercase characters. Also,
do not allow non-OEM characters in file names. File names that do not conform
to these limits require more than one physical directory entry on a PC Card.”

I confirm this “file name size is creating problem” by giving the same file
with 3 characters long, and application ran properly.

Now the main problem with me is, for my application user can give any file
to fill with, so in some cases my application will not be able to fill it
fully but will say that SD card filled completely.

Can anyone suggest me some way to complete it ….

.