bash - Check if a file exists inside a "Variable" Path -


i trying find if file exist in iphone application directory

unfortunately, apps directory differs device another

on device, use following command see if file exists:

if  [[ -f "/var/mobile/applications/d0d2b991-3cda-457b-9187-1f02a84ff3ab/appname.app/filename.txt" ]];      echo "the file exists";  else     echo "the file not exist"; fi  

i want command automatically search if file exist without need specify "variable" name inside path.

i tried this:

if  [[ -f "/var/mobile/applications/*/appname.app/filename.txt" ]];      echo "the file exists";  else      echo "the file not exist";  fi  

but no luck, didn't find file,

maybe because have 2 path of /var/mobile/applications/*/appname.app/ since have cloned app.

i way able find if file filename.txt exists inside folder named appname.app inside directory /var/mobile/applications/*/

you can follows:

[[ $(find /var/mobile/applications/*/appname.app/ -name filename.txt -print -quit | wc -l) -gt 0 ]] && echo "the file exists" || echo "the file not exist" 

Comments

Popular posts from this blog

jQuery Mobile app not scrolling in Firefox -

c++ - How to add Crypto++ library to Qt project -

php array slice every 2th rule -