Re: get list of file names from different subdirectories

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Fri, 4 Sep 2009 08:09:24 -0600 (MDT)

Let's say the files are in "/home/anandhi/main".

You could do something like this:

   cmd = "find /home/anandhi/main/a* -type f -print"
   fili = systemfunc(cmd)

You can also use variables:

   dir = "/home/anandhi/main"
   cmd = "find " + dir + "/a* -type f -print"
   fili = systemfunc(cmd)

--Mary

On Fri, 4 Sep 2009, Anandhi Aavudai wrote:

> Hi,
>
> I have a directory "main" which has 20 subdirectories "a1", "a2", "a3", "a4",....... "a20"
>
> Each of these 20sub directories have 3 netcdf files each
>
> how do I get the list of netcdf file names (20*3=60 file names) from main directory using systemfunc?
>
> fili = systemfunc("ls main\???\*.nc")
>
> is there anyother way I may get it other than writing the complete path many times.
>
> fili = systemfunc("ls main\a1\*.nc")
> .
> .
> .
> fili = systemfunc("ls main\a20\*.nc")
>
> Thanks in advance for the support.
>
> regards
> Anandhi
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Sep 04 2009 - 08:09:24 MDT

This archive was generated by hypermail 2.2.0 : Tue Sep 08 2009 - 11:49:50 MDT