Termux Internal External Storage

2021-02-26  本文已影响0人  大地缸

title: "Termux Internal External Storage"
date: 2021-02-15T10:31:40+08:00
draft: true
tags: ['termux']
author: "dadigang"
author_cn: "大地缸"
personal: "http://www.real007.cn"


关于作者

http://www.real007.cn/about

Internal and external storage

From Termux Wiki

Jump to: navigation, search

There are three main types of storage in Termux:

  1. App-private storage: Files put in $HOME, available from inside Termux (or when explictly picked, when e.g. attaching a file to a mail).
  2. Shared internal storage: Storage in the device available to all apps. On Android 6.0 this requires the user to explicitly grant access to for Termux to access it.
  3. External storage: Storage on external SD cards. Each app has a private folder on the external SD card, and interchange between them needs to use a special API not yet available in Termux. SAF-based access is not possible as shell is executed outside of Android framework.

Access shared and external storage

To access shared and external storage you need to run termux-setup-storage. You will then be prompted to "Allow Termux access photos, media and files on your device", which you should allow.

[图片上传失败...(image-acb058-1614343523532)]

Enlarge

Executing termux-setup-storage ensures:

  1. That permission to shared storage is granted to Termux when running on Android 6.0 or later.
  2. That an app-private folder on external storage is created (if external storage exists).
  3. That a folder $HOME/storage is created.

If you have Termux:API application and termux-api package installed, you can use Android file picker to get any file from either shared or external storage by using utility termux-storage-get. Example:

termux-storage-get filename.txt

File that has been chosen through file picker will be saved as "filename.txt".

~/storage

The contents of the created $HOME/storage folder are symlinks to different storage folders:

~/storage/shared

~/storage/downloads

~/storage/dcim

~/storage/pictures

~/storage/music

~/storage/movies

~/storage/external-1

上一篇 下一篇

猜你喜欢

热点阅读