Any local two way file sync app?
Added by ariel enter about 7 years ago
Does any body know of a good two way local file sync app between and android device and a computer? I found a program called adb-sync from google, but it's two way sync is very limited. Its two way sync doesn't account for deleted files for example.
I'm currently working on a bash script that uses find and stat in conjunction with a log book to determine changes, deletions and even name changes on files to make better synchronizations.
I'll post my work here once I finish it, but I fear that using bash would really limit its scope since it will be so dependent of the right version and encoding of the programs used both in the android device and the computer. I know I should use something else like python like the a for mention google adb-sync but I'm afraid I'm only familiar with bash and for know its easier for me.
Any way, if someone knows of a program that exist already will really save me a lot of work and time. Thank you.
Replies (5)
RE: Any local two way file sync app? - Added by Nichlas Severinsen about 7 years ago
RE: Any local two way file sync app? - Added by ariel enter about 7 years ago
Thanks a lot Nichlas, I was sure I searched on f-droid already. Maybe I missed it. Thank you. I'll check it out.
RE: Any local two way file sync app? - Added by Nichlas Severinsen about 7 years ago
Not sure if that's what you're looking for and I have not actually tested it on Replicant. If it's not what you're looking for I can probably help maintain or port your bash script to Python.
RE: Any local two way file sync app? - Added by ariel enter about 7 years ago
I think I'll end up my bash script and let you know. Thank you very much.
RE: Any local two way file sync app? - Added by ariel enter over 5 years ago
I have finally finished my script xD
You can find it here: https://github.com/arielenter/adb-sync-two-way-plus
I'll like to heared your comments. I have many of my own, but I'll be adding them over the days here, and also on a README file.
The part I most proud of is being able to see adb push and pull progress on a zenity dialog box, which is something I didn't see anyone else ever doing.
I'll like to share the man before I go:
USAGE: adb-sync-two-way-plus.sh Android_absolute_path Local_absolute_path [OPTIONAL Arguments]
NOTE: If no local directory is given, the current directory is used insted.
OPTIONAL Arguments:
--help Display this manual and exit ignoring
all other arguments and taking no accions.
-h Include hidden files.
-g Use zenity GTK+ (GUI) dialog boxes.
-f Use notify-send to send a system notification when a
synchronization has successfully ended. This will also
replace zenity's successful dialog box at the end if
option “-g” is used in conjunction with this option.
-m [4-8] When modifications to a file are found from both the
android device and the local device, the user will be
prompt to choose what to do. This option can be used
to give an upfront answer so that the user won't be asked.
The possible answers are the following:
4 Always Keep both files by renaming the oldest adding
its modification date/time to its name.
5 Always keep the file with the newest modifications.
6 Always keep the old one instead.
7 Always keep the local version.
8 Always keep the android version.
-d [3-6] When a file has been deleted in one side and modified in
the other, the user will be prompt to choose what to do.
This option can be used to give an upfront answer so that
the user won't be asked. The possible answers are the
following:
3 Always delete the file
4 Always keep the file if modifications were made
5 Always prioritize and choose the local operation
6 Always prioritize and choose the android operation
-a [adb_path] Specifie the adb binary that will be used.
This is useful if your system is not including
adb on its environment or shell variables, or
if you want to use a different version of adb
than the one installed in your system.
-s [Android_serial] If multiple android devices are connected, this
option can be added to specify witch one to use,
otherwise the user will be prompt to choose one
from a list of available devices.
-n The script won't check if your device is rooted and there
for capable of using “adb shell su”. “adb shell su” is
used to better keep time/date file stamps accurate, but
its used is not absolutely necessary for this script to
work, just recommended.
-r “adb root” would be run so that adb gains root access on
your device. This is useful if your android doesn't allow
any “adb push” to any directory at all without root. Also
it will allow “push -a”, which will help better keep
files' date/time stamps accurate. “adb root” or “adb
shell su” are not absolutely necessary for this script to
work but it is very much recommended. Unfortunately “adb
root” is not always available in all devices.
-t When files or directories are going to be deleted on your
local device because they were deleted on your android
device, this script will usually try send them to your
system trash bin using command “gvfs-trash”. If instead
you will like this elements to be permanently deleted,
you can use this option so that command “rm” is used.
This is also helpful if “gvfs-trash” is not available on
your system and installing it it's not an option.
-p This option can be used to prevent zenity's progress
dialog boxes from appearing even if option “-g” is given.
-w Normally, this script will show warns whenever it finds
an abnormality. For instance, there might be a local file
with a name that has an unsupported character for a file
on android, which will prevent it from being sync. Every
time a warn is given, the user will be asked if it wants
to continue anyway, for instance, without syncing those
files in the above mentioned example. By using this
parameter, the user won’t be asked, and all warnings
will be answered with a “yes”, and the script will
continue without any stop.