seeking fix for “File is too large for destination file system” erro

techman41973

New member
Local time
5:44 AM
Messages
5
seeking fix for “File is too large for destination file system” erro

I have a program I wrote in Visual Basic that copies a file from one directory into another directory at a prescribed interval. The Visual Basic programs uses the ShellFileCopy API function
ShellFileCopy Visual Basic 6 API Function
FreeVBCode code snippet: Copy Files Using the Shell API


99% of the time, the program works fine.
However occasionally, I get a Windows error that pop's up that says
"File is too large for the destination file system"
This is extremely baffling as the size of the file that is being copied is under 1MB.

Does anyone have any idea to what would be triggering this error in Windows 7?
Thanks
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
Why are you using ShellFileCopy()? I'm asking because I used it in some programs but it was a long time ago. For your purpose can't you just use FileCopy()?

If I remember, I used Shell copy because it provided a progress dialog. If the files are that small that won't come into play. Or is the small file just because you are testing?

Edit:

Ok, I think I may see the problem. The wrapper function uses Strings as source and destination. If you read the MSDN entry for SHFILEOPSTRUCT the source and destination strings must have a double null terminator. If not, the function will just keep reading memory getting the source or destination name until it finds a double zero.

You need to make a string compatible with LPCTSTR type that has a double zero a the end.
 
Last edited:

My Computer My Computer

At a glance

Windows 7 32 bitAMD 5200+ dual core2 GBNVidia GeForce 6150SE 128 MB
Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
Miles, from what I recall, I had issues with Filecopy that I couldn't resolve.
I just changed my code to use Filecopy again and for now it seems to be working, so I may stick with it.

Regarding your second bit of advice on using ShellFilecopy,

"You need to make a string compatible with LPCTSTR type that has a double zero a the end."

If this is truly the problem, why am I getting this error only occasionally?
And how would a string mismatch trigger a "file to large" error

Thanks again
 

My Computer My Computer

At a glance

Windows 7
OS
Windows 7
My initial reaction to seeing your first post was you must be using FAT32 instead of NTFS, but then of course reading further saw the file size you were talking about, so that doesn't become a factor... I realise this doesn't help you, but may some one else having a “File is too large for destination file system” error
 

My Computer My Computer

At a glance

Windows 7 Professional x86AMD 6400 x2 642x OCZ 1GB Platinum, 1x 2GB KingstonATI 3200HD PCI
OS
Windows 7 Professional x86
CPU
AMD 6400 x2 64
Motherboard
Gigabyte M-56s
Memory
2x OCZ 1GB Platinum, 1x 2GB Kingston
Graphics Card(s)
ATI 3200HD PCI
Sound Card
Onboard
Monitor(s) Displays
Dell CRT
Screen Resolution
1280x1024 @85Mhz
Hard Drives
WDC 1TB x2 Sata
Samsung 400GB Sata
WDC 500GB EIDE
PSU
Alntec
Cooling
Came with CPU
Keyboard
Standard wired 101 UK Layout
Mouse
Standard wired Optical Mouse
Internet Speed
Slow :)
Miles, from what I recall, I had issues with Filecopy that I couldn't resolve.
I just changed my code to use Filecopy again and for now it seems to be working, so I may stick with it.

Regarding your second bit of advice on using ShellFilecopy,

"You need to make a string compatible with LPCTSTR type that has a double zero a the end."

If this is truly the problem, why am I getting this error only occasionally?
And how would a string mismatch trigger a "file to large" error

Thanks again

The error may really mean the file path is too long. You are calling the ANSI version of the function. Meaning max path is like 260 characters. The erratic behavior is right in line with this type of error. If there happens to be a double zero in memory after the file path before it exceeds 260 characters you may not get the error. Have you checked the output file names for funky characters hanging on the end?

I haven't done that much VB but there must be a method to fill a buffer with zeroes. Then copy a string into it and use the address so that it's guaranteed to have at least 2 zeroes at the end of the string.

When there's a warning like that on the API docs, that's almost always the problem. I don't think VB strings by default have 2 zeroes at the end.
 

My Computer My Computer

At a glance

Windows 7 32 bitAMD 5200+ dual core2 GBNVidia GeForce 6150SE 128 MB
Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.

My Computer My Computer

At a glance

Windows 7 32 bitAMD 5200+ dual core2 GBNVidia GeForce 6150SE 128 MB
Computer Manufacturer/Model Number
HP Media Center
OS
Windows 7 32 bit
CPU
AMD 5200+ dual core
Memory
2 GB
Graphics Card(s)
NVidia GeForce 6150SE 128 MB
Monitor(s) Displays
CRT
Screen Resolution
1280x1024
Hard Drives
500 GB Sata internal :

SIIG USB 3.0 docking stations w/WD Caviar Black 6 Gb/s drives
Keyboard
PS/2
Mouse
PS/2 Wheel Mouse
Other Info
SIIG USB 3.0 PCIexpress card.
Back
Top