Skip to content

Instantly share code, notes, and snippets.

@GamerGirlandCo
Last active March 16, 2023 11:35
Show Gist options
  • Save GamerGirlandCo/655ba254f4998cef7bb180a7abddec08 to your computer and use it in GitHub Desktop.
Save GamerGirlandCo/655ba254f4998cef7bb180a7abddec08 to your computer and use it in GitHub Desktop.

hey!

this is a windows batch script meant to adb pull all folders in your /sdcard/ directory EXCEPT the ones you specify.

specifying additional folders to exclude:

add the following to the end of the command before -maxdepth 1:

-not -path "/sdcard/your_excluded_folder"

where your_excluded_folder is the name of the folder you don't want backed up. make sure you don't put a trailing / !


if i think of anything else to put in this readme, i'll add it. feel free to suggest stuff and/or ask any questions

@echo off
cd %userprofile%
rem the following line is so coloured text works.
for /F "delims=#" %%e in ('prompt #$E# ^& for %%a in ^(1^) do rem') do set esc=%%e
IF EXIST backup (
echo %esc%[32mbackup folder found!%esc%[0m
GOTO :pull
) ELSE (
echo %esc%[30m %esc%[0m
echo %esc%[31mbackup directory not found!%esc%[0m
echo ...
echo %esc%[33mcreating...%esc%[0m
md backup
GOTO :pull
)
:pull
cd backup
FOR /F usebackq %%H in (`adb shell find /sdcard/ -type d -not -path "/sdcard/Music" -not -path "/sdcard/Android" -not -path "/sdcard/" -maxdepth 1 ^& adb shell find /sdcard/ -type f -maxdepth 1`) DO (
adb pull %%H
)
del /Q "./DCIM/.thumbnails"
echo %esc%[30m %esc%[0m
echo %esc%[7;32mDONE~!%esc%[0m
pause>nul|set/p =...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment