B4J Question Rename a Folder?

Discussion in 'B4J Questions' started by aidymp, Apr 30, 2015.

  1. aidymp

    aidymp Active Member Licensed User

    Hi i have seen many questions & answers regarding renaming files! but what about folders? can it be done?

    I need to rename a folder so I can zip it and it will be be able to extract on android?

    the layout is exactly the same but the top level folder has a different name.

    PC
    MainFolder
    Sub1
    Sub2
    ~~~
    Sub100

    Android
    .mainfolder
    Sub1
    Sub2
    ~~~
    Sub100

    I zip the main folder then unzip but the Mainfolder name needs changing!

    Any help?
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    This code works for both files and folders:
    Code:
    Dim jo1, jo2 As JavaObject
    jo1.InitializeNewInstance(
    "java.io.File"Array("c:\temp\bitmaps"))
    jo2.InitializeNewInstance(
    "java.io.File"Array("c:\temp\bitmaps2"))
    Log(jo1.RunMethod("renameTo"Array(jo2)))
     
  3. aidymp

    aidymp Active Member Licensed User

    Thank you very much!
     
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