[Qgis-user] help to list files by bourne-shell

Zoltan Szecsei zoltans at geograph.co.za
Wed Jun 20 08:02:51 PDT 2012


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 ?
>
> reagards Jan :-)
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

The syntax should be:

for i in `ls xxx/*`
do
etc

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

-- 

===========================================
Zoltan Szecsei PrGISc [PGP0031]
Geograph (Pty) Ltd.
P.O. Box 7, Muizenberg 7950, South Africa.

65 Main Road, Muizenberg 7945
Western Cape, South Africa.

34° 6'16.35"S 18°28'5.62"E

Tel: +27-21-7884897  Mobile: +27-83-6004028
Fax: +27-86-6115323     www.geograph.co.za
===========================================




More information about the Qgis-user mailing list