{"id":2603,"date":"2025-04-27T17:35:34","date_gmt":"2025-04-28T00:35:34","guid":{"rendered":"https:\/\/www.curlybrace.com\/words\/?p=2603"},"modified":"2025-04-27T17:35:34","modified_gmt":"2025-04-28T00:35:34","slug":"using-adb-to-deploy-music-to-an-android-device","status":"publish","type":"post","link":"https:\/\/www.curlybrace.com\/words\/2025\/04\/using-adb-to-deploy-music-to-an-android-device\/","title":{"rendered":"Using ADB To Deploy Music to An Android Device"},"content":{"rendered":"<p>I like to manually manage my collection of MP3 files on my Android phone.  Making folders and copying contents by hand in Windows Explorer is a pain, since I also have FLAC files that I usually don&#8217;t want to copy.  Here is a batch file I made that uses ADB to copy all of the album folders in the current directory, along with all contained MP3 and JPG files.<\/p>\n<p>Three assumptions are made:<br \/>\n1)  Music files are stored on the SD card.<br \/>\n2)  Music files are stored using the folder layout of Music\/Artist\/Album.<br \/>\n3)  This batch file is called from the Artist directory on the PC.<\/p>\n<pre class=\"DOS\">\r\n@echo off\r\nREM This script copies deploys music files to the connected Android device.\r\nREM All subfolders are created and all .mp3 and .jpg files are copied.\r\n\r\nREM Get the SD card folder under \/storage.  It will be in the form of 1234-5678:\r\nset SDCARD_FOLDER=\r\nfor \/f \"usebackq delims==\" %%i in (`adb shell \"ls -d \/storage\/????-????\"`) do set SDCARD_FOLDER=%%i\r\n\r\nif \"%SDCARD_FOLDER%\" == \"\" goto NoSDCardFolder\r\n\r\nREM Get the name of the current folder without any leading path:\r\nfor %%i in (.) do set current_folder=%%~ni%%~xi\r\n\r\nREM Make sure this artist folder exists on the Android device:\r\nadb shell \"mkdir \\\"%SDCARD_FOLDER%\/Music\/%current_folder%\\\"\"\r\n\r\nREM For each subfolder...\r\nfor \/f \"usebackq delims==\" %%i in (`dir \/b \/ad`) do (\r\n    echo \"%%i\"\r\n\r\n    REM Make this subfolder on the Android device:\r\n    adb shell \"mkdir \\\"%SDCARD_FOLDER%\/Music\/%current_folder%\/%%i\\\"\"\r\n\r\n    REM Enter the subfolder and copy each file to the Android device...\r\n    pushd \"%%i\"\r\n    for \/f \"usebackq delims==\" %%j in (`dir \/b \/a-d *.mp3;*.jpg`) do (\r\n        adb push \"%%j\" \"%SDCARD_FOLDER%\/Music\/%current_folder%\/%%i\/%%j\"\r\n    )\r\n    popd\r\n)\r\n\r\nexit \/b\r\n\r\n:NoSDCardFolder\r\necho Unable to find SD card folder on Android device.<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I like to manually manage my collection of MP3 files on my Android phone. Making folders and copying contents by hand in Windows Explorer is a pain, since I also have FLAC files that I usually don&#8217;t want to copy. &hellip; <a href=\"https:\/\/www.curlybrace.com\/words\/2025\/04\/using-adb-to-deploy-music-to-an-android-device\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15,283],"tags":[],"class_list":["post-2603","post","type-post","status-publish","format-standard","hentry","category-technology","category-windows-technology"],"_links":{"self":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/2603","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/comments?post=2603"}],"version-history":[{"count":4,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/2603\/revisions"}],"predecessor-version":[{"id":2607,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/posts\/2603\/revisions\/2607"}],"wp:attachment":[{"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/media?parent=2603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/categories?post=2603"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.curlybrace.com\/words\/wp-json\/wp\/v2\/tags?post=2603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}