FileTools : Get some tools to work with files

1.Introduction

Once again I am here to present my second extension to community.
FileTools
Probably you have read in title , the name of extension is FileTools and features are similar to its name.
It provides tools to work with Files (folders also).

Latest Version: 3
Last Updated: 2019-10-20T18:30:00Z

2.Blocks

A wide range of blocks…
21-17_58_39

21-18_00_22

21-18_02_33

21-18_05_54

21-18_06_39

It has total 29 function/method blocks and 5 event blocks

3.Usage

As it has ‘so many’ blocks so I will show how to use them one by one.

component_method

Path to application specific directory i.e., /storage/emulated/0/Android/date/<package name>/files

Thanks to @bodymindpower

component_method%20(1)

Returns a list of available storage directories.
Note: Not working properly sometimes.So use with caution.

blocks%20(18)

Copies file from source to destination folder.It triggers ‘FileCopied’ event will boolean true or false
Note: It can not create folder.It can only copy files between existing folders

component_method%20(2)

Creates Application Specific Directory (/storage/emulated/0/Android/data/<package name>/files) in case it does not exists

blocks%20(19)

Creates a single directory.It triggers ‘Directory Created’ with boolean true or false
Note:It can not create multiple directories.In this case, this will not work if ‘data’ does not exists

blocks%20(39)

Deletes given directory including all files in it

blocks%20(20)

Deletes a file if it exists.It triggers ‘FileDeleted’ event with boolean true or false

blocks%20(21)
blocks%20(22)

Returns true if file or folder exists else false

blocks%20(23)

Gets file extension(mp3,mp4,txt,etc) of file.
Note: Sometimes it can return .file if it is unable to get file extension

blocks%20(24)

Gets file list from the given folder with filter (if applied)
Extenion:- .mp3 , .txt , .png , .jpeg , etc

blocks%20(25)

Returns that file is hidden or not

blocks%20(26)

Checks that given path is complete path or not
For example: /testt.txt and /mnt/sdcard/Android/com.sunny.notez/files/testt.txt are not same.

blocks%20(40)

Returns that folder/file is executable or not

blocks%20(41)

Returns true if given path is/has file

blocks%20(42)

Returns 1 if path is file , 2 if path is folder else -1

blocks%20(43)

Returns true if file/folder is hidden else false

blocks%20(44)

Returns true if file/folder is readable else false

blocks%20(45)

Returns true if file/folder is writable else false

blocks%20(46)

Last modified time of file/folder in given format

blocks%20(47)

Mime type of given file
In above case it will return text/plain

blocks%20(48)

Moves file from source to destination and deletes original file

blocks%20(49)

Converts content uri to actual path

blocks%20(50)

Renames file without deleting it

blocks%20(51)

Returns total space of directory

blocks%20(52)

Returns free space of directory

blocks%20(53)

Gets files and folders list and raises event ‘GotFileList’ with a list of files and folders

blocks%20(54)

Get a list of folder/sub directories of given directory

4.Aix/Extension file

Here are two download links:
1.Download link 1: File_Tools.aix (20.1 KB)

2.Download link 2: File_Tools.aix - Google Диск

5.Credits

It was not only me who was included in making this extension.
A lot of people helped me to make this extension.
I want to say thank you @deepanshu_da85 and @MeteorCoder for helping me in making FileTools:heart_eyes:
StackOverFlow also helped me a lot in making FileTools
And a lot of thanks to @KodularCreator for this awesome platform:heart:
Honorable mention:
@bodymindpower for reporting some bugs and changes

6.Updates/Bug Fixes

ChangeLog Version 2

New blocks
Added two new blocks

Bug Fixes

  • All methods returning files list will now return empty list(if files list is empty) instead of runtime error
  • Mime Type method will return mime type with more accuracy.
  • Fixed some null pointer exceptions
ChangeLog Version 3

New blocks

Added three new blocks

component_method%20(5)

component_method%20(6)

component_method%20(4)

Changes
New version includes changes in some blocks

  • ‘Application Specific Directory’ now returns path to ASD
  • Replaced ‘File’ with ‘FileSystems’ in ‘Available Storage Directory’ block but I am not sure it is working or not

Bug Fixes

  • Some changes in ‘Available Storage Directory’ block
16 Likes

And here is a question:

Should I give Aia file?

  • Yes
  • No
  • Can’t say

0 voters

2 Likes

Nice Work Bro, Keep it up, :heart_eyes:

Thank you:heart_eyes:

1 Like

As far I know these volume/drive letters are only used on Windows. :sweat_smile:

And, what happens if we retrieve a list of files and folders? You know, it takes a while to list them. (I didn’t tested yet by the way) So I hope it is not stopping the app activity while this block finishes its job. :slightly_smiling_face:

I think you should remove my mention, I didn’t really help you because I didn’t get to your PM in time before you got a fix from someone else :sweat_smile:

Great job soon I will try it

Actually when I run code in Intellij IDEA it returned those names so I copy-pasted them here :sweat_smile:

For me it does not matters that you got my PM or not but you encouraged me to find solution myself.

Fun Fact(s)

1.The blocks Application Specific Directory was the block I asked to @MeteorCoder for help.
2. Then I asked @deepanshu_da85 for help and he gave me this method.

public String getPackageName()

But I found it hard to implement.
3.So I searched on Google and StackOverFlow and got some not working solutions.
4.I don’t know why I opened AppyBuilder Code Editor and got a public extension related to Version Name and Version Code.
I got my solution after some unsuccessful ‘modifications’

Those two blocks took half time of FileTools’ other blocks.

I don’t think my name’s should be there as the really things which helped you are:


Keep developing :+1:

5 Likes

Yes…you are right :heart_eyes:
StackOverFlow helped me a lot…

2 Likes

ChangeLog Version 2

New blocks
Added two new blocks

Bug Fixes

  • All methods returning files list will now return empty list(if files list is empty) instead of runtime error
  • Mime Type method will return mime type with more accuracy.
  • Fixed some null pointer exceptions
2 Likes

Have you used FileTools?

  • Yes
  • No

0 voters

What is your experience using FileTools?

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10

0 voters

Yes, I just took a quick look and I noticed a few things compared to Taifun’s File extension:

  • FileTools.ApplicationSpecificDirectory does not give the full path like Taifun’s File extension, but (true / false). However, to access files in this folder, the full path (Companion / APK) is required. Please change / add this.

  • FileTools.AvailableStorageDirectories does not show any directory (Taifun does it)

I’ll take a closer look at the extension later …
Good work! :+1:

1 Like

Actually application specific directory returns true if ASD exists else false.
And thanks for bug report.
I will try to solve the problem as soon as possible.
Thank you.

Yes, I know, but we need also the path to access files in this folder. So please add this.

1 Like

:+1:
Will be added.

1 Like

ChangeLog Version3

New blocks

Added three new blocks

component_method%20(5)

component_method%20(6)

component_method%20(4)

Changes
New version includes changes in some blocks

  • ‘Application Specific Directory’ now returns path to ASD
  • Replaced ‘File’ with ‘FileSystems’ in ‘Available Storage Directory’ block but I am not sure it is working or not

Bug Fixes

  • Some changes in ‘Available Storage Directory’ block
1 Like