0

Example :

find /sdcard/ \( -iname '*.gif' -o -iname '*.sh' \) -exec ls -l {} \;
-rw-rw---- root     sdcard_r      552 2016-01-11 02:31 scr.sh
-rw-rw---- root     sdcard_r       12 2017-06-20 09:44 2.gif

will print scr.sh and 2.gif with no full pathes? How print this with full pathes like

-rw-rw---- root sdcard_r 552 2016-01-11 02:31 /sdcard/scr.sh

or something ?

  • 1
    Possible duplicate of Absolute path with ls? – Lenniey Jul 18 '17 at 8:40
  • 1
    not exactly duplicate , i think – ilw Jul 18 '17 at 13:03
  • Works fine for me: find /boot/ -name "*default" -exec ls -l {} \; gives -rw-r--r-- 1 root root 7241840 Jul 22 05:01 /boot/vmlinuz-4.11.8-2-default – sebix Aug 6 '17 at 7:42
3

What you have should work - for example:

Linux (Ubuntu 16.04)

$ find /var/www/html -type f -exec ls -l {} \;
-rw-r--r-- 1 root root 6 Nov 29  2016 /var/www/html/index.html

Linux (CentOS 7)

$ find ~/ -iname '*.txt' -exec ls -l {} \;
-rw-rw-r-- 1 craig craig 0 Jul 18 08:33 /home/craig/1.txt
-rw-rw-r-- 1 craig craig 0 Jul 18 08:33 /home/craig/2.txt

Mac (10.11.6)

$ find ~/Desktop \( -iname '*.txt' -o -iname '*.localized' \) -exec ls -l {} \;
-rw-r--r--  1 craig  staff  0 13 May  2016 /Users/craig/Desktop/.localized
-rw-r--r--  1 craig  staff  0 18 Jul 09:29 /Users/craig/Desktop/file.txt
| improve this answer | |
  • My fall, i'm try before in Android shell. With toolbox ls - print no pathes, with busybox ls - all fine. Hmm. Thanks. – ilw Jul 18 '17 at 8:42
  • Another problem. If find print folder - ls print list in folder. How avoid this without -type f ? – ilw Jul 18 '17 at 8:44
0

Simply with -ls subcommand:

find /sdcard/ \( -iname '*.gif' -o -iname '*.sh' \) -ls
| improve this answer | |
0

If you're in the directory where you want to search from, subbing in pwd will make find print full paths. E.g:

cd /sdcard/
find $(pwd) \( -iname '*.gif' -o -iname '*.sh' \)
| 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.