Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"bad date" from "touch" when using -t option #56

Open
jgurling opened this issue Jul 18, 2021 · 1 comment
Open

"bad date" from "touch" when using -t option #56

jgurling opened this issue Jul 18, 2021 · 1 comment

Comments

@jgurling
Copy link

Hi, I'm trying to use adb-sync with the -t option to preserve file datestamps. Running on Ubuntu 20.04, connected to OnePlus 5 via USB. See code output below - seems like it's calling "touch" command which is taking issue with value (or format?) 20190103.103814. Is this an issue with adb-sync, or something on my end?

james@wagtail-fossa:~$ adb-sync -t ~/1p5\ backup\ 2021-06-18/DCIM/CameraTest /sdcard/DCIM/
INFO:root:Sync: local b'/home/james/1p5 backup 2021-06-18/DCIM/CameraTest', remote b'/sdcard/DCIM//CameraTest'
INFO:root:Scanning and diffing...
INFO:root:Push: b'/sdcard/DCIM//CameraTest/IMG_20190103_103812.jpg'
/home/james/1p5 backup 2021-06-18/DCIM/CameraTest/IMG_20190...812.jpg: 1 file pushed. 20.2 MB/s (4110909 bytes in 0.194s)
INFO:root:Push-Times: accessed Sat Jul 17 23:40:52 2021, modified Thu Jan 3 10:38:14 2019
touch: bad date 20190103.103814
INFO:root:Total: 7514 KB/s (4110909 bytes in 0.534s)
Traceback (most recent call last):
File "/home/james/.local/bin/adb-sync", line 883, in
main()
File "/home/james/.local/bin/adb-sync", line 877, in main
syncer.PerformCopies()
File "/home/james/.local/bin/adb-sync", line 646, in PerformCopies
self.dst_fs[i].utime(dst_name, (s.st_atime, s.st_mtime))
File "/home/james/.local/bin/adb-sync", line 312, in utime
raise OSError('touch failed')
OSError: touch failed

@altblue
Copy link

altblue commented Feb 4, 2022

Same here, because

adb shell 'touch --help' |grep -P '^-t'
-t	Set time to TIME (in [[CC]YY]MMDDhhmm[.ss][frac] format)

I monkey patched it by changing those two strftime templates accordingly:

time.strftime('%Y%m%d%H%M.%S'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants