I have a problem with find
. It doesn't find *.sh files if I am in certain directory level. It does, however, find *.sql files.
/path$ cd do_not_upload/updates/1.1.1/
/path/do_not_upload/updates/1.1.1$ find . -path *.sh
./run_pre_update/002.sh
./run_pre_update/001.sh
./run_post_update/001.sh
/path/do_not_upload/updates/1.1.1$ find . -path *.sh
./run_pre_update/002.sh
./run_pre_update/001.sh
./run_post_update/001.sh
/path/do_not_upload/updates/1.1.1$ cd ..
/path/do_not_upload/updates$ find . -path *.sh
./1.1.3/run_pre_update/002.sh
./1.1.3/run_pre_update/001.sh
./1.1.3/run_post_update/001.sh
./1.1.1/run_pre_update/002.sh
./1.1.1/run_pre_update/001.sh
./1.1.1/run_post_update/001.sh
/path/do_not_upload/updates$ cd ..
/path/do_not_upload$ find . -path *.sh
./updates/1.1.3/run_pre_update/002.sh
./updates/1.1.3/run_pre_update/001.sh
./updates/1.1.3/run_post_update/001.sh
./updates/1.1.1/run_pre_update/002.sh
./updates/1.1.1/run_pre_update/001.sh
./updates/1.1.1/run_post_update/001.sh
/path/do_not_upload$ cd ..
/path$ find . -path *.sh
/path$ find . -path *.sql
./do_not_upload/updates/1.1.3/sql_migrations/002.sql
./do_not_upload/updates/1.1.3/sql_migrations/001.sql
./do_not_upload/updates/1.1.1/sql_migrations/002.sql
./do_not_upload/updates/1.1.1/sql_migrations/001.sql
$ find --version
find (GNU findutils) 4.4.2
/path$ stat do_not_upload/
File: ‘do_not_upload/’
Size: 60 Blocks: 0 IO Block: 4096 directory
Device: 14h/20d Inode: 159862 Links: 3
Access: (0775/drwxrwxr-x) Uid: ( 1000/ jorgee) Gid: ( 1000/ jorgee)
Access: 2014-09-10 14:02:34.449376973 -0300
Modify: 2014-09-10 13:54:13.805363567 -0300
Change: 2014-09-10 13:54:13.805363567 -0300
Birth: -
do_not_upload
a symlink? Also, don't forget to quote the*.sh
so the shell doesn't expand it. – Mikel Sep 10 '14 at 19:38stat do_not_upload
to confirm? – Mikel Sep 10 '14 at 19:40do_not_upload/.../sql_migrations
too. – Mikel Sep 10 '14 at 19:43*.sh
and*.sql
? It's a good habit anyway. – Mikel Sep 10 '14 at 19:45find . -follow -path '*.sh'
. – dg99 Sep 10 '14 at 19:50"
to the*.sh
does work.... However I don't understand why it doesn't work for .sh and does work for .sql (without the"
) – JorgeeFG Sep 10 '14 at 19:57nullglob
andfailglob
can be used to change bashs behaviour when globbing fails a bit. – Wieland Sep 10 '14 at 21:02