0

For starters, I am on a Nexus 5, on Android 6.0.1 and I am rooted.

Normally, I'd just do this

find /path -maxdepth 1 -type f -printf '%TY%Tm%Td%TH%TM%Ts %p\n'

However, it appears that busybox, though it gives a lot of functionality, does not include the printf feature of find.

Is there any way I can do this, or possibly even get a fully functional version of Find?

0

I found a version of findutils compiled for Android here

http://forum.xda-developers.com/showthread.php?t=1268589

I did the following.

  1. I copied the find binary to my phone
  2. I moved it to /data/local/tmp/find
  3. chmod +x /data/local/tmp/find
  4. Ran the find command I wished to run

(I am rooted, but I did not use the su command here, so I'm not certain if this requires root or not. I have an unrooted phone I can test this on later to see if it's still possible in those circumstances.)

I made a shell script to assist with my ultimate goal.

cp /sdcard/find.bin /data/local/tmp/find.bin > /dev/null 2>&1
chmod +x /data/local/tmp/find.bin > /dev/null 2>&1
/data/local/tmp/find.bin "$1" -type f -printf 'touch -t %TY%Tm%Td%TH%TM '"'"'%p'"'"'\n'
rm /data/local/tmp/find.bin > /dev/null 2>&1

EDIT: This appears to work on an unrooted phone as well!!!!

EDIT2: While this step works, you need to be rooted to change the modification time with touch, so this isn't useful for what would come next.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.