1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Android の写真動画を CLI から Windows に backup する

1
Posted at

Explorer (GUI) だと不安定なので嫌だ、あとすでに backup 済の file は skip したい。
Google Pixel 8a で確認

Windows 側の準備 (初回のみ)

Backup 手順

  1. Android を USB で繋ぐ、充電モードで構わない
  2. Android を開発者モードにする
    1. デバイス情報 -> ビルド番号を 7 回連続タップ
    2. システム -> 開発者向けオプション -> USB デバッグを on
  3. Command Prompt で以下の bat を実行
    1. 初めて繋いだときに Android 側の画面で許可するかどうか聞かれる気がする
  4. 後処理
    1. Android の "USB デバッグが接続されました" をタップして USB デバッグを無効にしておく
    2. 開発者向けオプションの使用も無効にしておく

bat

@echo off
setlocal EnableDelayedExpansion

rem コピー元・コピー先を設定
set "srcDir=/sdcard/DCIM/Camera"
set "dstDir=C:\<your_backup_dir_path>"

rem adb でフォルダ一覧を取得してループ
for /f "usebackq delims=" %%F in (`adb shell ls "%srcDir%"`) do (

    rem Windows 上の存在チェック
    if not exist "%dstDir%\%%F" (
        echo Copying: %%F
        adb pull "%srcDir%/%%F" "%dstDir%"
    ) else (
        echo Skipping: %%F, already exists
    )
)

echo.
echo -- completed, hit any key --
pause >nul

endlocal
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?