Here is a Java code :
*private static void _printTree(String root,int depth)
{
if(root==null || root.trim().length()==0)
return;
File f=new File(root);
if(f.isFile()==true)
{
printTab(depth);
System.out.printf("%s\n",f.getName());
return;
}
if(f.isDirectory()==true)
{
printTab(depth);
System.out.printf("%s\n",f.getName());
String[] filelist=f.list();
if(filelist==null)
return;
for(String file:filelist)
{
_printTree(root+File.separator+file, depth+1);
}
return;
}
return;
}
public static void printTree(String root)
{
_printTree(root, 0);
}*
Thanks & Regards
Anantha Krishnan
On Wed, Jul 27, 2011 at 1:21 PM, geek forgeek <[email protected]> wrote:
> can some one give me the code plz?
>
>
> On Wed, Jul 27, 2011 at 12:26 AM, sunny agrawal
> <[email protected]>wrote:
>
>> yes Preorder recursion will be good for displaying in User Friendly way...
>>
>>
>> On Wed, Jul 27, 2011 at 12:49 PM, Anand Saha <[email protected]> wrote:
>>
>>> Implement Preorder Traversal in the File system tree.
>>>
>>> --
>>>
>>>
>>>
>>> On Wed, Jul 27, 2011 at 12:06 PM, geek forgeek <[email protected]>wrote:
>>>
>>>> Function to display the directory structure in a user friendly way
>>>> taking root dir as arg
>>>> for a general OS. You may assume and state some basic APIs available in
>>>> that OS
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google
>>>> Groups "Algorithm Geeks" group.
>>>> To post to this group, send email to [email protected].
>>>> To unsubscribe from this group, send email to
>>>> [email protected].
>>>> 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 [email protected].
>>> To unsubscribe from this group, send email to
>>> [email protected].
>>> For more options, visit this group at
>>> http://groups.google.com/group/algogeeks?hl=en.
>>>
>>
>>
>>
>> --
>> Sunny Aggrawal
>> B-Tech IV year,CSI
>> Indian Institute Of Technology,Roorkee
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.