Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Test for NO files

Status
Not open for further replies.

barryp

Programmer
Jan 30, 2002
48
GB
Here is a simple script

for i in tempdata/*.xml
do
php -q XML2Compass.php $i
done

With NO xml files in tempdata the php script is executed with $i set to the string "tempdate/*.xml"

So I get ugly php errors about fopen() failing

I just want to find out whether there are any XML files BEFORE the FOR loop

 
Thanks! - that works

Any way I can lose the message from ls

"ls: tmp/*.xml: No such file or directory"

??
 
2> /dev/null vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
vlad: you are also an old unix fox!!
say please it rigth, this is my be a newcommer, does known /dev/null ???:

for file in `ls /tmp/*xml 2>/dev/null`
do ......
done
 
maybe OR maybe NOT - so far I haven't heard a follow up question. Have you?

Either way.... Regardless of the posting styles... Whatever makes the OP happy. vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top