whoozle / android-file-transfer-linux

Android File Transfer for Linux (and macOS!)
http://whoozle.github.io/android-file-transfer-linux/
GNU Lesser General Public License v2.1
1.42k stars 119 forks source link

Document how to transfer files using aft-mtp-cli with examples #301

Open jidanni opened 2 years ago

jidanni commented 2 years ago

https://whoozle.github.io/android-file-transfer-linux/ and also the aft-mtp-cli man page have no examples of how to copy a file or directory or anything.

jidanni commented 2 years ago

https://whoozle.github.io/android-file-transfer-linux/FAQ.html shows one uses "get Pictures". Perhaps this will copy all the files in that directory.

Best would be a complete shell session example.

jehoshua7 commented 2 years ago

Yes, some documents would be great. I have finally been able to get the CLI working ( https://github.com/whoozle/android-file-transfer-linux/issues/307#issuecomment-1109142021 ), and now not knowing what commands I can use ..

Samsung Electronics Co., Ltd. SM-G930F / Galaxy S7 [93%]:Phone>

Although there is help ..

aft-mtp-cli -h

usage: -h --help show this help -v --verbose show debug output -i --interactive force interactive mode -b --batch batch command processing -e --events allow event processing -f --input-file use file to read input commands -C --no-claim no usb interface claim -R --reset-device reset usb device before connecting -d --device-name use device name (could be partial name, e.g. model or manufacturer) -l --device-list list devices -V --version show version information

BostX commented 2 years ago

File transfer: Phone -> Computer

~/dev/android-file-transfer-linux/build ──────────────────────────────────────────────────
❯ cli/aft-mtp-cli
selected storage 65537 SECZ9519043CHOHB Phone
android file transfer for linux version v4.2-33-g299a01f
Samsung Electronics Co., Ltd. SM-G398FN G398FNXXSGCVE1
extensions: microsoft.com: 1.0; samsung.com/kies: 5.0; samsung.com/devicestatus: 0; 
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> ls
1          Signal
2          Movies
3          Sounds
4          DualApp
5          Documents
6          Pictures
7          Alarms
8          Audiobooks
9          Podcasts
10         Ringtones
11         Telegram
12         DCIM
13         Notifications
14         Download
15         Music
16         Threema
17         Samsung
18         Android
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> cd DCIM/ 
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> ls
19         Screenshots
20         Camera
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> cd Camera/ 
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> ls
21         20211023_142458.jpg
22         20210604_143613.jpg
[... abbreviated ... ]
679        20211022_221417.jpg
680        20220109_184918.jpg
681        20200815_121730.jpg
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> get 20200815_121730.jpg 
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> exit
~/dev/android-file-transfer-linux/build ──────────────────────────────────────────────────
❯ ls -la
total 9536
drwxr-xr-x  6 bost users    4096 Jun 10 20:06 .
drwxr-xr-x 12 bost users    4096 Jun 10 19:22 ..
-rw-r--r--  1 bost users 8483417 Aug 15  2020 20200815_121730.jpg
drwxr-xr-x  3 bost users    4096 Jun 10 19:44 cli
-rw-r--r--  1 bost users   26274 Jun 10 19:27 CMakeCache.txt
drwxr-xr-x  7 bost users    4096 Jun 10 19:44 CMakeFiles
-rw-r--r--  1 bost users    2298 Jun 10 19:27 cmake_install.cmake
-rw-r--r--  1 bost users 1181298 Jun 10 19:44 libmtp-ng-static.a
-rw-r--r--  1 bost users   35164 Jun 10 19:27 Makefile
drwxr-xr-x  3 bost users    4096 Jun 10 19:44 python
drwxr-xr-x  3 bost users    4096 Jun 10 19:27 qt

File transfer: Computer -> Phone

~/dev/android-file-transfer-linux/build ──────────────────────────────────────────────────
❯ cli/aft-mtp-cli
selected storage 65537 SECZ9519043CHOHB Phone
android file transfer for linux version v4.2-33-g299a01f
Samsung Electronics Co., Ltd. SM-G398FN G398FNXXSGCVE1
extensions: microsoft.com: 1.0; samsung.com/kies: 5.0; samsung.com/devicestatus: 0; 
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> cd DCIM/Camera/ 
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> put CMakeCache.txt
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> ls CMakeCache.txt
error: Get: invalid response code InvalidParentObject (0x201a)
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> ls
21         20211023_142458.jpg
22         20210604_143613.jpg
[... abbreviated ... ]
679        20211022_221417.jpg
680        20220109_184918.jpg
681        20200815_121730.jpg
702        CMakeCache.txt
Samsung Electronics Co., Ltd. SM-G398FN / Galaxy XCover 4s [100%]:Phone> exit
~/dev/android-file-transfer-linux/build ──────────────────────────────────────────────────

The ls CMakeCache.txt shows an error however the file was transferred successfully. (I also checked it on the phone)