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


  1. Posts : 5
    Windows 7
       #1

    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


  2. Posts : 5,092
    Windows 7 32 bit
       #2

    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 by MilesAhead; 06 Dec 2011 at 16:58.
      My Computer


  3. Posts : 5
    Windows 7
    Thread Starter
       #3

    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


  4. Posts : 4
    Windows 7 Professional x86
       #4

    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


  5. Posts : 5,092
    Windows 7 32 bit
       #5

    techman41973 said:
    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


  6. Posts : 5,092
    Windows 7 32 bit
       #6

    SHFILEOPSTRUCT structure

    See the entries for pFrom and pTo
      My Computer


 

  Related Discussions
Our Sites
Site Links
About Us
Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

© Designer Media Ltd
All times are GMT -5. The time now is 12:22.
Find Us