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

2012-06-20 Thread Alister Hood
Hi,

> Date: Wed, 20 Jun 2012 17:02:51 +0200
> From: Zoltan Szecsei 
> 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 rm myfiles
> 
> HTH,
> Zoltan

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


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

2012-06-20 Thread Donovan Cameron
You can also try it with a simple test:

*
for i in C:/Users/tappenbeck/Desktop/Project/*
do [ -d "$i" ] && echo "$i" is directory
done*


Notice that because it is in a shell script and is broken into separate
lines already, the semi-colons ";" have been removed.

You only need semicolons when placing it in one line, like copy and pasting
into a terminal instead of running from a script.




Take your pick =)



Donovan

On Wed, Jun 20, 2012 at 12:51 PM,  wrote:

> Hi Jan
>
>
> for i in C:/Users/tappenbeck/Desktop/Project/*;
>
> change to :
>
> for l in `ls C:/Users/tappenbeck/Desktop/Project/` ;
>
>
> enclosing a comand in back quotes will return the result of the command, &
> you want to return a list iof the contents of the folder, not the string
> which is the folder name.
>
>
> --- On *Thu, 6/21/12, Jan Tappenbeck * wrote:
>
>
> From: Jan Tappenbeck 
> Subject: [Qgis-user] help to list files by bourne-shell
> To: "qgis-mailingliste" 
> Date: Thursday, June 21, 2012, 2:36 AM
>
>
> 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@lists.osgeo.org <http://mc/compose?to=Qgis-user@lists.osgeo.org>
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


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

2012-06-20 Thread pcreso
Hi Jan

for i in C:/Users/tappenbeck/Desktop/Project/*;

change to :

for l in `ls C:/Users/tappenbeck/Desktop/Project/` ;


enclosing a comand in back quotes will return the result of the command, & you 
want to return a list iof the contents of the folder, not the string which is 
the folder name.


--- On Thu, 6/21/12, Jan Tappenbeck  wrote:

From: Jan Tappenbeck 
Subject: [Qgis-user] help to list files by bourne-shell
To: "qgis-mailingliste" 
Date: Thursday, June 21, 2012, 2:36 AM

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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user


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

2012-06-20 Thread Zoltan Szecsei

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@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
donehttp://lists.osgeo.org/mailman/listinfo/qgis-user


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

2012-06-20 Thread Jan Tappenbeck

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@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/qgis-user