Hi,

> Date: Wed, 20 Jun 2012 17:02:51 +0200
> From: Zoltan Szecsei <zolt...@geograph.co.za>
> To: qgis-user@lists.osgeo.org
> Subject: Re: [Qgis-user] help to list files by bourne-shell
> Message-ID: <4fe1e61b.8050...@geograph.co.za>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> On 2012/06/20 16:36, Jan Tappenbeck wrote:
> > hi !
> >
> > i want to create a script for use in msys - but i am not a linux-user.
> > i try to create this by a template:
> >
> > #!/bin/sh
> > # Einfaches Beispiel
> >
> > for i in C:/Users/tappenbeck/Desktop/Project/*;
> > do
> > if [ -d "$i" ];
> > then
> > echo $i is directory;
> > fi;
> > done
> >
> > but there will no files list - can anyone help me ?

If you actually mean there are no _directories_ listed, I don't know what's 
going on.  It works for me, either running the script from the msys rxvt, or 
from the msys dos prompt (by running `sh script_path_and_name`).

If you really do mean there are no _files_ listed, try adding `else echo $i is 
file`.

BTW, they don't hurt, but you don't need any of those semicolons at the end of 
lines (;).  You need semicolons to separate separate commands that you want to 
write on the same line.

> > reagards Jan :-)
> >
> > _______________________________________________
> > Qgis-user mailing list
> > Qgis-user@lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/qgis-user
> 
> The syntax should be:
> 
> for i in `ls xxx/*`
> do
> etc

If you want to do that, why complicate things by using ls?
Why not just use `for i in */*; do` ?

> but if you have spaces in your file names, i will contain the words
> delimited by these spaces.
> 
> fiddle with something like:
> 
> ls -1 xxx/* > myfiles
> while read i
> do
>    wadda-wadda
> done<myfiles
> rm myfiles
> 
> HTH,
> Zoltan

Alister
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user

Reply via email to