aidymp Well-Known Member Licensed User Longtime User Apr 30, 2015 #1 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?
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?
Erel B4X founder Staff member Licensed User Longtime User Apr 30, 2015 #2 This code works for both files and folders: B4X: 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))) Upvote 0
This code works for both files and folders: B4X: 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)))
aidymp Well-Known Member Licensed User Longtime User May 1, 2015 #3 Erel said: This code works for both files and folders: B4X: 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))) Click to expand... Thank you very much! Upvote 0
Erel said: This code works for both files and folders: B4X: 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))) Click to expand... Thank you very much!