FileTools : Some tools to work with files

I haven’t tested the apk file of your. I just followed the process of the image, you have posted. My apk is working as it should.

Ok, so where is the problem?

These blocks are working as it should. Not an issue so far.

Hi @Coder007
Are you trying to get last modified time of files of phone’s storage?
For me it returns 0L or 01/01/1970 05:30:00 AM only if I provide wrong filename.
Here are my test results:
image

Try to get last mod time from file’s uri i.e. add file:// before file name.
Because extension uses relative (/ is path to root of sdCard) path only for sdCard and you will have to use uri with files of phone’s storage.

1 Like

U mean :point_right: Example: /storage/emulated/0/Download/demo.pdf

I have to add file://before the path, right?

Final : file:///storage/emulated/0/Download/demo.pdf

Am I right??

1 Like


** Working perfectly.

1 Like

I was right :sunglasses:

1 Like

Hey is it possible to sort(descending) files according to date of last modification?

Format of last modification date : dd-MM-yyyy

Yes you can do it using dictionary and list utils extension.
First convert all dates in timestamp and store all filenames and timestamps in dictionary.
Now sort timestamps using list utils extension and then get filenames according to timestamp.

There can be a lot of methods to do same and it is one of them.

1 Like

@vknow360 Copying a file (test.txt) from the assets to external storage does not work with Companion or with the APK.

Example:

/storage/emulated/0/test.txt
relative path: /test.txt

copyFormAssets.apk (5.0 MB)

TaifunFile ext. works. App Inventor Extensions: File | Pura Vida Apps (APK)

Blocks

3 Likes

ChangeLog Version 9

Bug Fixes

  • Fixed bug in CopyFile and CopyFileAsync methods which were not copying file from assets
    Thanks to @bodymindpower
  • Fixed bug in IsFile method which was returning false for every asset’s file

Changes

  • Some internal changes
  • Removed some un-necessary libraries (but somehow aix’s size increased :sweat_smile: )

Previous Version’s (that were available on Drive)

com.sunny.FileTools (1).aix (39.6 KB)
com.sunny.FileTools (2).aix (34.6 KB)
com.sunny.FileTools (3).aix (33.4 KB)

3 Likes

Greetings
How much I miss your guidance :relaxed:
Can I apply the ( Read from ) [ file extension ] block to CSV file in Firebase storage without downloading this CSV file ???
11 !

I checked it on Android 9 with APK:
It does not work.

copyFormAssets2.aia (63.8 KB)

Hi @bodymindpower
CopyFile method does not triggers FileCopied event so you will never get correct result from event.

Yes, but as you can see there is a button (Button3) to check it.

I shall check it as soon as possible.

Btw, it works on Android 7 with APK.

1 Like

It also works on Bluestacks in Companion.
I think issue is only on Android Pie and higher versions.

it also works on Android 8.1

I checked it again on several devices with Android 9 and 10:
It works. The problem with Note8 (Android 9) is now also solved after de-/installing the app.

So it’s working on Android 5, 7, 8.x, 9, 10.

1 Like