If you often do coding and running Nodejs or Python3 scripts on Termux, you will know the pain that sometimes, it is not convenient to copy the input and output files between Termux sandbox and phone storage. It takes time to type the cp command and the filenames on the Termux terminal.

We need a File Manager with GUI.

To have a File Manager with GUI, you can install and configure GUI for the whole Termux and then use VNC to have the File Manager with GUI.

Here we can use a different and simple solution, using WebDav with your favourite Android File Manager.

On Termux we need to have Nodejs installed and on Android a File Manager that supports WebDAV. I use CX File Explorer (link) for this purpose.

Now install webdav-cli

npm install --global webdav-cli

Just in case you need to generate SSL:

pkg install openssl-tool

With the below command, we will start a webdav-cli server with username, password as p. For security, you can use a more complicated password, here for simplicity and a quick note, I use p.

npx webdav-cli --username p --password p --directory true --autoIndex true  

It will show the IP and port something like this:

Homepage: https://github.com/svtslv/webdav-cli  
  
Server running at http://127.0.0.1:1900  
[rights]: all  
[digest]: false  
username: p  
password: p  
Hit CTRL-C to stop the server  
Run with --help to print help

Open your Android File Manager, here CX File Manager. Go to Network, + New location, REMOTE, then choose WebDav, fill in with the above information.

Now you should be able to copy or move files easily. To stop the webdav-cli, hit Ctrl + C.

Tips

  1. You can make an alias name for the command below. Remember the username and password must be fixed. Otherwise, you have to update your WebDav login every time.
npx webdav-cli --username p --password p --directory true --autoIndex true  

  1. Run npx webdav-cli --help or visit its project repository to learn more options, including SSL options.