[algogeeks] MS Question: WAP to find files in a directory/subdirectories

2012-06-02 Thread Ashish Goel
ls-r implementation needed...


Best Regards
Ashish Goel
Think positive and find fuel in failure
+919985813081
+919966006652

-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MS Question: WAP to find files in a directory/subdirectories

2012-06-02 Thread atul anand
i wrote this program in college labbut used shell script to
simulate ls -r functionality.
now to do in c or java .. we only need to knw about the libraries to use.

On 6/3/12, Ashish Goel ashg...@gmail.com wrote:
 ls-r implementation needed...


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.



-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MS Question: WAP to find files in a directory/subdirectories

2012-06-02 Thread Navin Kumar
#include stdio.h
#include stdlib.h
#include sys/types.h
#include dirent.h
#include unistd.h
#include ctype.h
#include string.h

void dirfun(char *);


int main()
{

char *home=/home/navin/temp/;
dirfun(home);
return 0;
}


void dirfun(char *path)
{
struct dirent *dir;
DIR *dp= opendir(path);

if(dp!=NULL)
{
while((dir = readdir(dp)))
{
if(dir-d_type == DT_DIR)
{
if(strcmp(dir-d_name,.) 
strcmp(dir-d_name,..))

 printf(%s\n,dir-d_name);



}
else

printf(%s\n,dir-d_name);



}
  }
 }



On Sun, Jun 3, 2012 at 8:14 AM, Ashish Goel ashg...@gmail.com wrote:

 ls-r implementation needed...


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.


-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



Re: [algogeeks] MS Question: WAP to find files in a directory/subdirectories

2012-06-02 Thread Navin Kumar
you can set your directory path in this line

char *home=/home/navin/temp/;

On Sun, Jun 3, 2012 at 11:26 AM, Navin Kumar algorithm.i...@gmail.comwrote:



 #include stdio.h
 #include stdlib.h
 #include sys/types.h
 #include dirent.h
 #include unistd.h
 #include ctype.h
 #include string.h

 void dirfun(char *);


 int main()
 {

 char *home=/home/navin/temp/;
 dirfun(home);
 return 0;
 }


 void dirfun(char *path)
 {
 struct dirent *dir;
 DIR *dp= opendir(path);

 if(dp!=NULL)
 {
 while((dir = readdir(dp)))
 {
 if(dir-d_type == DT_DIR)
 {
 if(strcmp(dir-d_name,.) 
 strcmp(dir-d_name,..))

  printf(%s\n,dir-d_name);



 }
 else

 printf(%s\n,dir-d_name);




 }
   }
  }



 On Sun, Jun 3, 2012 at 8:14 AM, Ashish Goel ashg...@gmail.com wrote:

 ls-r implementation needed...


 Best Regards
 Ashish Goel
 Think positive and find fuel in failure
 +919985813081
 +919966006652

 --
 You received this message because you are subscribed to the Google Groups
 Algorithm Geeks group.
 To post to this group, send email to algogeeks@googlegroups.com.
 To unsubscribe from this group, send email to
 algogeeks+unsubscr...@googlegroups.com.
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
You received this message because you are subscribed to the Google Groups 
Algorithm Geeks group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.