Hi everybody.
I need a command to print the absolute path of files which name starts always with a pattern (MOD03), independently on where they are in the filesystem.
I have tryed
ls -ld ${INPUTPREFIX}/*/*/* | grep MOD03 | awk '{ print $8 }'
but I have to use "/*/*/*" in this case to have the needed output: if the directory structure is different, this command fails.
I have also tryed with
find /my/path/* -type f -name MOD03*
but I dont' know how to make it recursive in a way to check every subdirectory.
Can anyone help me?
cd /
find / -type f -name "M0D03*"
this should print all files with M0D03 in their name with absolute pathname.
# find / -type f -name "*.png"
/var/www/manual/images/feather.png
/var/www/manual/images/mod_rewrite_fig2.png
/var/www/manual/images/custom_errordocs.png
/var/www/manual/images/mod_rewrite_fig1.png
/var/www/manual/mod/mod_python/icons/contents.png
/var/www/manual/mod/mod_python/icons/index.png
/var/www/manual/mod/mod_python/icons/up.png
/var/www/manual/mod/mod_python/icons/previous.png
/var/www/manual/mod/mod_python/icons/next.png
/var/www/manual/mod/mod_python/icons/modules.png
/var/www/manual/mod/mod_python/icons/blank.png
/var/www/manual/ssl/ssl_intro_fig2.png
/var/www/manual/ssl/ssl_intro_fig3.png
/var/www/manual/ssl/ssl_intro_fig1.png
/var/www/icons/folder.png
/var/www/icons/left.png
/var/www/icons/back.png
/var/www/icons/burst.png
find . -name "MOD03"
this will print all the files with MODO3 in them
It should be exactly what I need, but unfortunately it doesn't work:
user@office-007 /media/LaCie $ find /media/LaCie/ -type f -name "M0D03.*"
user@office-007 /media/LaCie $
And I'm shure that inside this directory I have thousand on that files:
candini@MEEO-office-007 /media/LaCie $ ls -ld /media/LaCie/*/*/*/*/* | grep MOD03 | awk '{ print $8 }'
/media/LaCie/MODIS/results/200712/A20073601145005/MOD03.A2007360.1145.005.2007360224843.hdf
/media/LaCie/MODIS/results/200712/A20073601150005/MOD03.A2007360.1150.005.2007360225137.hdf
/media/LaCie/MODIS/results/200712/A20073610910005/MOD03.A2007361.0910.005.2007361192701.hdf
...
Any other ideas?
EDIT:
Sorry, I was searching for "M0D03" (two zeros) and not "MOD03" (one capital 'o' and one zero).
After correction, it works perfectly...thaks!
Yes, as edited above now it works perfectly.
Thanks!