menu TechnoSparks
keyboard_arrow_up

 ts-binds: Bind Two Different Folders

Subpages

 Table of contents coming soon

ts-binds relies on a configuration file located in the internal storage of your device for any of its features to work. The filename is ts-binds-folderlist.txt and is editable by the user with any text editors. We will call this file as folderlist.

Syntax

Syntax that you must follow when adding a “folder pair”:

folderbind <Pair name> [$sd]<Source/SD path> [$int]<Target/Internal path>

All three arguments are required and the arguments must be quoted if there is a whitespace.

Bind/pair name
Gives the “folder pair” a name so that you can easily do operations on it in terminal functions. For example, tsbinds unbind <Pair name>

Source / SD path
Source path that you want the folder pair to show files from. $sd is a required variable if you want to bind from/to external storage.

Target / Internal path
Target path that you want to override with the source path. $int is a required variable if you want to bind from/to internal storage.

Adding a folder pair

Common pair

When you open the folderlist, you can see a simple for-reference as an example concerning WhatsApp folder. That is basically how you bind two different paths.

folderbind whatsapp "$sd/Application Data/WhatsApp" $int/WhatsApp

This makes the WhatsApp folder on your SD Card (/Application Data/WhatsApp) mirror its contents to the WhatsApp folder in internal storage (/WhatsApp). Notice the quotes for the path of SD Card. The quotes are required if the path contains spaces, as explained in the "Syntax" section previously.

 Both folders must exist beforehand otherwise the bind operation will fail. ts-binds do not automate folder creation.
 Please use the $sd and $int variable if you are binding across storages. This is because ts-binds uses special algorithm to deal with cross-storage binding.

Adding an OBB pair

Although the obb folder resides in the internal storage, it is actually mounted from another path.

If you wish to bind the obb folder, you can add this line instead in the folderlist:

folderbind "$sd/Application Data/Android/obb" $obb

If you don't like binding the whole folder, this work too:

folderbind "$sd/Application Data/Game Files/PUBG" $obb/com.tencent.ig
folderbind "$sd/Application Data/Game Files/Fortnite" $obb/com.epicgames.fortnite

Above should suffice, but if do not work, you can try to use this:

folderbind "$sd/Application Data/Android/obb" $int/Android/obb

Uncommon pair

If you are intending to create a folder pair that doesn’t involve between internal and external storages, the $sd and $int can be removed. For example, if you wish to bind your own created folder in /data/myOwnFolder to /data/app/Something you can add a folder pair similar to this

folderbind overwriteApp /data/myOwnFolder /data/app/Something

File pair!

Although against the semantic meaning of a “folder pair”, you could also bind two different files together with the very same syntax.

folderbind myhosts /data/myhosts.txt /system/etc/hosts

Note that this may hide the destination file (in this example /system/etc/hosts) on your device if browsed using a file manager. Reason for this is rather unknown. It could be something to do with the Android ROM itself, as listing the file via terminal ls shows nothing abnormal.

 This is just an example! It is always best to use "systemless host" provided by the Magisk Manager.

Apply changes

There are three ways you can do this

The fastest way is by executing the following in a terminal emulator. This will re-run the shell script that is supposed to be run during boot-up. su -c automatically executes the following parameters under root rights.

su -c tsbinds reinit

A slower one would be first gaining root right:

su
tsbinds reinit

Slower than before, you can also do this:

su
tsbinds unbind all
tsbinds update
tsbinds bind all

The slowest of all: you can just reboot.

Handling Media Storage Duplicates

By default, Android indexes media if the folder or file is not hidden, or if a directory do not contain a .nomedia file. If you bind two different folders of which have any properties mentioned, you will end up with duplicating contents if viewed via a Gallery.

There is no fix to this given because of how media scanner works, but you can workaround this issue by simply using .nomedia file. You may either hide the destination folder by appending a dot (.) in front of the folder’s name, or simply add a .nomedia file and end up both directories not indexed.

You may alternatively nest the directory that is binded (either the one in internal or external) into another folder, and then add .nomedia file for that parent folder. This is what I do in my case.

Example: Assuming the following folder pair is used in the folderbind file

folderbind whatsapp $sd/WhatsApp $int/WhatsApp
# Hiding the source folder by appending dot in front
Internal/
  └── WhatsApp/
      └── [reflects source]
External/
  └── .WhatsApp/
      └── […]

# Adding a .nomedia file in the source folder hence making both folders not indexed at all
Internal/
  └── WhatsApp/
      └── [reflects source]
External/
  └── WhatsApp/
      ├── .nomedia
      └── […]

# Nest directory that is binded in a hidden folder. Notice ".data"
Internal/
  └── WhatsApp/
      └── [reflects source]
External/
  └── .Data/
      └── WhatsApp/
          └── […]

# Nest directory that is binded in a folder that contains a .nomedia (my preferred method)
Internal/
  └── WhatsApp/
      └── [reflects source]
External/
  └── Data/
      ├── WhatsApp/
      │   └── […]
      └── .nomedia


Unbinding folders and other integral operations

Please open the terminal emulator and run the following:

su
tsbinds help
# or `tsbinds h` works too

You will be presented with a summary of all commands that you can use with ts-binds.

Troubleshooting

Please inspect the log file generated in your internal storage with the file name ts-binds.log to have an insight of what is going on when expected folder pair doesn’t work.

You might also want to check the Troubleshooting page.

Advertisement