B4A Library File handling library

HotShoe

Well-Known Member
Licensed User
Longtime User
Looking forward to using this lib. Just curious, is the zip part adapted from the ABZipUnzip lib? just asking because I had problems with that lib in the past.

No, the zip routines are not a part of any lib.

--- Jem
 

HotShoe

Well-Known Member
Licensed User
Longtime User

Not a pain at all! I do not have a server with spaces in the name here. I'll have to set up one of my servers to use names with spaces and test here. I'll try to find what is going on this week.

--- Jem
 

HotShoe

Well-Known Member
Licensed User
Longtime User

The GetDiskFree returns a string with 3 values in it and cannot be converted to a number as returned. I have added a new GetFreespace method that returns a Long that should work for you. Grab the 1.2 version and try that.

--- Jem
 

johnaaronrose

Active Member
Licensed User
Longtime User
GetFreeSpace

The GetDiskFree returns a string with 3 values in it and cannot be converted to a number as returned. I have added a new GetFreespace method that returns a Long that should work for you. Grab the 1.2 version and try that.

--- Jem

Thanks, Jem: works correctly. I was baffled by the Format As Boolean parameter: I assumed True. What does this parameter mean?
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Thanks, Jem: works correctly. I was baffled by the Format As Boolean parameter: I assumed True. What does this parameter mean?

Actually it is unused. I meant to remove that but forgot. Originally I was going to return the result as a string and the return format would be as bytes, megabytes, or gigabytes. I decided just to do bytes and gigabytes and use 2 separate methods, but then forgot to remove that parameter. I'll fix that in the next release.

Thanks,

--- Jem
 

cmweb

Active Member
Licensed User
Longtime User
Hello,

could someone please give an example how the cpr works?

ml.cpr("/sdcard/external_sd/Documents","/sdcard/Documents") doesn't work for me.

Thanks for any help...

Best regards,

Carsten
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Hello,

could someone please give an example how the cpr works?

ml.cpr("/sdcard/external_sd/Documents","/sdcard/Documents") doesn't work for me.

Thanks for any help...

Best regards,

Carsten

Are you sure that first path is correct? external_sd would normally be /mnt/external_sd. /sdcard is its own mount point. Check the ml.fserror to see if there is anything in that variable.

--- Jem
 

cmweb

Active Member
Licensed User
Longtime User
Path is correct on a Samsung Galaxy Note.

The cp example in your Example App doesn't work as well...

Best regards,

Carsten

Gesendet von meinem GT-N7000 mit Tapatalk 2
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Path is correct on a Samsung Galaxy Note.

The cp example in your Example App doesn't work as well...

Best regards,

Carsten

Gesendet von meinem GT-N7000 mit Tapatalk 2

I don't see a problem in your code as long as the paths are correct and capitalization is ok. I just wrote a quick test and ran it on an unrooted phone with no problems

B4X:
        tmp = sd & "MLtest/" 'sdcard returns the path with a trailing /
   
   ok = fs.mkdir(tmp) ' make a new directory
   
   ok = fs.touch(tmp & "Test") 'create an empty file (or change the file access time/date to NOW if it exists)
   
   If ok Then
   ok = fs.cp(tmp & "Test", tmp & "reTest") ' copy the file
   End If
   
   fs.mkdir("/mnt/sdcard/tst")
   
   ok = fs.cpr(tmp,"/mnt/sdcard/tst")

Thanks,

--- Jem
 

cmweb

Active Member
Licensed User
Longtime User
But why doesn't it work on my unrooted Note?

Best regards,

Carsten
 

HotShoe

Well-Known Member
Licensed User
Longtime User
But why doesn't it work on my unrooted Note?

Best regards,

Carsten

I don't know. I'll try it on my wife's S3 when she gets home.

--- Jem
 

HotShoe

Well-Known Member
Licensed User
Longtime User
But why doesn't it work on my unrooted Note?

Best regards,

Carsten

Try the new 1.40 version of the lib attached to the first post. I think this one will solve the problem. It seems Samsung stopped including some common OS commands such as cp, but they do supply busybox. This version uses busybox if it is available.

--- Jem
 

HotShoe

Well-Known Member
Licensed User
Longtime User
Update on Samsung and other devices

Well it seems update 1.40 will NOT solve the problem of copying files and directories. I was told that Samsung includes busybox, but it and others use the standard toolbox utility (so does the emulator), but that utility does not include the cp command. It is simple to copy files in Linux (android) without the cp command for rooted or non rooted devices. Copying directories is much more complicated though.

I have existing routines in both C and Pascal to do recursive copying, but it is not a simple set of commands that I can add in a few minutes. This adds considerable size to the library, but is the cleanest way. I have fixed the single file copy routine for the next release, but the recursive copy will have to wait for a while.

--- Jem
 

Stulish

Active Member
Licensed User
Longtime User
Jem,

I have now changed my network drive's name to 2TB, to get rid of the spaces, but the thing still doesn't work, saying 'Errors:The system cannot find the file specified.'

any ideas

the path is now:

smb://192.168.0.2/2TB/

cheers

Stu
 

HotShoe

Well-Known Member
Licensed User
Longtime User

Hey stu, can you please grab the smbtst.zip attached here and try it out. I'm struggling to find a problem.

Thanks,

--- Jem
 

Attachments

  • smbtst.zip
    8.4 KB · Views: 279

Stulish

Active Member
Licensed User
Longtime User
Jem,

I quickly ran the file and the screen is just blank, the log file is below:


I will have a longer look tomorrow as it is late

thanks

Stu
 

HotShoe

Well-Known Member
Licensed User
Longtime User
I have no idea why the listview wouldn't be initialized. That should happen as soon as the layout is loaded.

--- Jem
 

HotShoe

Well-Known Member
Licensed User
Longtime User
update to 1.4.1

Updated to version 1.4.1. See the first post for details and the attachment.

-- Jem
 

cmweb

Active Member
Licensed User
Longtime User
Updated to version 1.4.1. See the first post for details and the attachment.

-- Jem

Great. Thanks a lot! I'll give it a try...

Best regards,

Carsten

Gesendet von meinem GT-N7000 mit Tapatalk 2
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…