Created
November 23, 2022 11:57
-
-
Save Akasurde/1e88dc81e4e7e7b545faa6e102f717d1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
rfolder=/mnt/sdcard/DCIM/Camera | |
adb shell ls "${rfolder}" > android.files | |
lfolder=/Volumes/data/documents/personal/camera | |
ls -1 "${lfolder}" > local.files | |
rm -f update.files | |
touch update.files | |
while IFS= read -r q; do | |
# Remove non-printable characters (are not visible on console) | |
l=$(echo ${q} | sed 's/[^[:print:]]//') | |
# Populate files to update | |
if ! grep -q "$l" local.files; then | |
echo "$l" >> update.files | |
fi | |
done < android.files | |
script_dir=$(pwd) | |
cd $lfolder | |
while IFS= read -r q; do | |
# Remove non-printable characters (are not visible on console) | |
l=$(echo ${q} | sed 's/[^[:print:]]//') | |
echo "Get file: $l" | |
adb pull "$rfolder/$l" | |
done < "${script_dir}"/update.files | |
lines=$(wc -l "${script_dir}"/update.files | awk '{ print $1 }') | |
echo "${lines} files copied." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment