Android Question Getting number of files of manually created folders

Discussion in 'Android Questions' started by Sub7, Feb 18, 2015.

  1. Sub7

    Sub7 Active Member Licensed User

    Hello, i need to get the number of file in some folders manually moved to file.dirassets
    in future releases is i may need to add some more files, i'd like to avoid to correct all the code by updating the default values.



    Code:
    Dim fileCount As List
    fileCount = 
    File.ListFiles(File.DirAssets) 'OK

    fileCount = 
    File.ListFiles(File.DirAssets&"/foldername"'NOT OK
    'error java.io.IOException: AssetsDir/foldername is not a folder.

    Log(fileCount.Size)

    Code:
    'Bad code
    Dim numfiles as int = 50 'I know the total number of files in file.dirassets/foldername
    if counter <= 50 Then....

    'I prefer
    if counter <= filecount.size Then....

    any walktrought?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    File.ListFiles doesn't work with subfolders inside the assets folder.
     
  3. Sub7

    Sub7 Active Member Licensed User

    Ok thanks.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice