locked
Detecting whether it is possible to create a file larger than 4GB on target file system

    Question

  • Hi,

    I have a WinRT app that needs to sync files which some times might be larger than 4GB to a tablet. Unfortunately, if the file system is FAT32, a single file cannot be larger than 4GB and the user will experience an error during sync. Is there a way to determine whether the file system supports files larger than 4GB before actually writing the file, so we can inform the user upfront?

    Thanks,

    Pedro


    • Edited by Pedro Pombeiro Wednesday, November 12, 2014 1:11 PM improve wording
    Wednesday, November 12, 2014 1:11 PM

Answers

  • IN Win32, you used to be able to create a sparse file.  It would fail on FAT, but work on NTFS. 

    You'd do this by opening the file, then calling SetFileLength with the large size of the requested file.  It would fail if the system couldn't support it, or fail if the disk didn't have enough space, without writing any file data. 

    You may be able to OpenAsync on a StorageFile, get the IRandomAccessStream and then set the length via the Size parameter, but I haven't tried that.

    http://msdn.microsoft.com/en-us/library/windows/apps/hh438400.aspx


    Darin R.

    Tuesday, November 18, 2014 1:32 AM

All replies

  • Hi Pedro,

    Per my understanding, the win 8 system is sitting on NTFS file system. It’s no need to check the file size restrictions.

    Local app data should be used for any information that needs to be preserved between app sessions and is not suitable type or size wise, for roaming app data. Data that is not applicable on other devices should be stored here as well. There are no general size restriction on local data stored. Location is available via thelocalFolder property. Use the local app data store for data that it does not make sense to roam and for large data sets. – from MSDN.

    You can find the above explanation in Local App Data section from the following link. http://msdn.microsoft.com/en-us/library/windows/apps/xaml/hh464917.aspx.

    If you still have questions, please post more information about your scenario.

    Regards,


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place. Click HERE to participate the survey.

    Thursday, November 13, 2014 5:34 AM
    Moderator
  • Herro:

    Windows Phone apps can be moved to an SD card on Windows Phone 8.1.  Those apps might find themselves running from a FAT32 or exFAT filesystem.

    Further, a modern Windows app might be asked to store content on a non-system drive by the user, and that drive could be formatted with any filesystem, including FAT32/exFAT.

    So there can indeed be file size restrictions.  The question here is how a "modern" app can detect them in advance.

    Tuesday, November 18, 2014 12:23 AM
  • IN Win32, you used to be able to create a sparse file.  It would fail on FAT, but work on NTFS. 

    You'd do this by opening the file, then calling SetFileLength with the large size of the requested file.  It would fail if the system couldn't support it, or fail if the disk didn't have enough space, without writing any file data. 

    You may be able to OpenAsync on a StorageFile, get the IRandomAccessStream and then set the length via the Size parameter, but I haven't tried that.

    http://msdn.microsoft.com/en-us/library/windows/apps/hh438400.aspx


    Darin R.

    Tuesday, November 18, 2014 1:32 AM