当前位置: 首页>后端>正文

Termux Internal External Storage

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:

  • The root of the shared storage between all apps.
~/storage/shared

  • The standard directory for downloads from e.g. the system browser.
~/storage/downloads

  • The traditional location for pictures and videos when mounting the device as a camera.
~/storage/dcim

  • Standard directory in which to place pictures that are available to the user.
~/storage/pictures

  • Standard directory in which to place any audio files that should be in the regular list of music for the user.
~/storage/music

  • Standard directory in which to place movies that are available to the user.
~/storage/movies

  • Symlink to a Termux-private folder on external storage (only if external storage is available).
~/storage/external-1


https://www.xamrdz.com/backend/3s71995712.html

相关文章: