Reproduce DOS 'tree' command to a real directory structure

Hi guys,
I have the output of a DOS 'tree' command (small example below). And I'm trying to reproduce the output of this command (directories and files) as another directory structure, I've tried several different things with no real luck. My biggest problem is that I'm unable to get the logic down to correctly nest directories. I was just wondering if anyone would be able to give me any code examples to help me out, it's a long shot as what I'm doing is pretty abstract, but any advice or code would be a great help.
Thanks, aqzman
+---Eagle Files
|   |   DESCRIPTION
|   |
|   +---AnalogFE1
|   |   |   ANALOGFE1C.brd
|   |   |   ANALOGFE1C.sch
|   |   |   ANALOGFE1D.sch
|   |   |   ANALOGFE1E.brd
|   |   |   ANALOGFE1E.s#1
|   |   |   ANALOGFE1E.sch
|   |   |   DESCRIPTION
|   |   |   eagle.epf
|   |   |
|   |   +---V2
|   |           ANALOGFE1B.b#1
|   |           ANALOGFE1B.b#2
|   |           ANALOGFE1B.b#3

You need to read the group of directories and files in a recursive manner. If what you read is a directory, create that as a new directory where you are creating the new entries. If you read a file, then copy that file to the new directory you created.
To get more information on recursive programming, use Google to search for explanations and examples.
This tutorial has explanations and examples of reading directory entries and files, and creating directories and copying files.
[http://java.sun.com/docs/books/tutorial/essential/io/index.html]
Also read the File class API, as you will use the methods it provides.

Similar Messages

  • Real directory name of a file path?

    How do I find the normalized directory name of a path?
    For example, when you cd to a directory you get what ever was in the cd command, not the real directory name.
    See:
    mac $ ls -l co
    lrwxr-xr-x   1 mac  staff  15 Aug  9 19:38 co@ -> /Users/mac/cons
    mac $ cd co
    mac $ pwd
    /Users/mac/co
    mac $ cd .
    mac $ pwd
    /Users/mac/co
    mac $ cd ..
    mac $ pwd
    /Users/mac
    mac $ cd cons
    mac $ pwd
    /Users/mac/cons
    mac $ ls -ld .
    drwxr-xr-x   31 mac  staff  1054 Aug  9 12:12 ./
    mac $ pwd
    /Users/mac/cons
    mac $ 
    I this example, I want /Users/mac/cons not /Users/mac/co
    Robert

    My results from /bin/pwd are different.
    Found out about the -P option to pwd command. There is also the set -P which effects the pwd result. see man pwd and help pwd and help set
    something so simple is so complicated.
    Thanks for the function. Pointed out a bug in the script I am working on. I am not checking the user passed me a directory path. Could be a file.
    mac $ cd co
    /Users/mac/co
    mac $ /bin/pwd
    /Users/mac/cons
    mac $ PWD="" /bin/pwd 
    /Users/mac/cons
    mac $ settings       
    mac $ pwd
    /Users/mac/co
    mac $ man pwd
    mac $ pwd -P
    /Users/mac/cons
    mac $ pwd -L
    /Users/mac/co
    mac $ cd /USERS/MAC/CO
    /USERS/MAC/CO
    mac $ pwd
    /USERS/MAC/CO
    mac $ pwd -P
    /Users/mac/cons
    mac $ pwd -L
    /USERS/MAC/CO
    mac $ /bin/pwd
    /Users/mac/cons
    ---------- env
    MANPATH=/sw/share/man:/usr/share/man:/usr/local/share/man:/usr/X11R6/man:/sw/lib /perl5/5.8.6/man
    TERM_PROGRAM=Apple_Terminal
    TERM=xterm-color
    SHELL=/bin/bash
    PERL5LIB=/sw/lib/perl5:/sw/lib/perl5/darwin
    TERM_PROGRAM_VERSION=133-1
    OLDPWD=/USERS/MAC
    USER=mac
    __CF_USER_TEXT_ENCODING=0x3E8:0:0
    PATH=/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/Developer/Tools:/usr/X11R6/ bin
    XML_CATALOG_FILES=file:///Library/DTDs/catalog file:///etc/xml/catalog
    PWD=/USERS/MAC/co
    EDITOR=/usr/bin/pico
    PS1=\u \$ 
    PS2=additional input: 
    SHLVL=1
    HOME=/Users/mac
    INFOPATH=/sw/share/info:/sw/info:/usr/share/info
    DISPLAY=:0.0
    SECURITYSESSIONID=603760
    _=/usr/bin/env
    --------- set
    BASH=/bin/bash
    BASH_VERSINFO=([0]="2" [1]="05b" [2]="0" [3]="1" [4]="release" [5]="powerpc-apple-darwin8.0")
    BASH_VERSION='2.05b.0(1)-release'

  • B Installing 9 brings up DOS SETUP command window then fails

    Installing 9 starts and then a DOS SETUP command box appears, asking to insert Disk 1 DOS Install floppy in drive a: It then fails to do the 9 install, no matter what I do. It simply fails ! I tried installing in SAFE MODE, but still does the same thing. Cannot get any help on this from several XP forums, or from Microsoft. Any ideas ?

    Errol, you've asked this question several times without getting a
    response - presumably because nobody can fathom your setup.
    If the PATH command in your boot sequence points to a directory
    containing a 'setup.exe', it looks like the installer picks that one
    instead of the right one. Try temporarily renaming the wrong
    setup.exe or modifying PATH to force the installer to look in the
    right place.
    Noel

  • Tree command in terminal

    hi there... I wonder is there any command in Mac OS X' terminal that is equivalent to "tree" command in linux? thanx

    You could install fink and install tree-
    fink info tree
    Information about 6332 packages read in 2 seconds.
    tree-1.5.1.1-1: Recursive directory listing program
    Web site: http://mama.indstate.edu/users/ice/tree/
    Maintainer: Max Horn <[email protected]>
    or I suppose you could compile it from source.

  • How to create a tree based on directory structure

    I want to create a hierarchical tree in Forms 6i based upon a file system directory structure (similar to Windows Explorer). How can I populate a tree with this information, is there something that I can call or write that would return the file system structure in a format that I can populate my tree?
    Any advice would be greatly appreciated.
    Thanks
    Richard

    Your link does not seem to work.They're re-jigging all the links to accomodate the hot poop on Oracle's latest and greatest, 10G. So at least the website is on schedule even if the actual software delivery dates have slipped :P
    We can still get D2KWUTIL from here: http://te chnet.oracle.com/software/products/forms/content.html
    Cheers, APC

  • Export images to a directory structure based on a collection tree?

    A question:
    Will lightroom have the capability to export images to a directory structure which mirrors a collections logical structure?
    The reason I ask this is that when I create websites using third party tools (eg, Jalbum) I typically generate a flash or HTML based site with an menu structure for navigating the images.
    So, the image interface is not simply a "flat-file" display as per the templates in Lightroom beta.
    To do this, with previous image management tools (eg, iMatch) I create a hierarchy of images based on the categories (or collections) that the images are assigned to, export the images in a folder tree reflecting their categories (or collection), then use, say, Jalbum, to generate the website with the menu tree reflecting the folders/images.
    This is extremely useful for more complicated image websites with categories and a large no of images.
    If this function was built into Lightroom I guess it would be in the export function such that the "write to folder" box could take an argument {collection name} which would create a folder tree reflecting the collections logical tree which is being exported.
    Apologies if this topic has been raised previously. But this function is extremely useful if you are using third party html tools or simply building websites by hand.
    Regards
    Alistair

    I started simmilar thread in Lightroom Feature Requests few months ago, but can't find it anymore since new forum version...
    What I can suggest as a new feature is export to directory structure from collections or second option from keywords. Probably more usable and easier to implement would be from collections.
    What I need it to export many photos to different directories pretty often, and this would be great help since I could arrange them in collections and collection sets. Then select collection set and export it in a manner that collection set would be main export directory, and each collection within the set would be exported to its own folder within main collection set export folder.
    This would be much appreciated feature in near future
    Thank you for great product by the way

  • Hana db filesystem directory structure and process command line

    Hi experts,
    Could someone provide please actual directory structure of Hana db filesystem?
    Generally speaking, I need to model some Hana db(of 1.0, 1.5 versions) entities. Among them:
    Schemas
    Data files
    Log files
    Important configuration files
    Database parameters(guess found in config files and command line)
    Database version
    The question is where i can find such information having access to filesystem?
    One another question is how common Hana db commandline looks like?
    Does it have one process or several?
    It would be perfect if someone give some ps -aef command result grepped with relevant Hana Db processes
    Thanks,
    Eugene
    Edited by: Eugene Kondrashev on Dec 28, 2011 12:51 PM

    Eugene Kondrashev wrote:
    > * What are the processes relevant to Hana Db?
    This is still changing pretty much ...
    Anyhow, just check the running services in HANA studio (landscape tab) and you have all the process at hand.
    > * What is the signature of starting command?
    What is that supposed to mean?
    > * How can I identify running Hana Db instance on a host having shell access?
    How about the HDB command?
    SUSE Linux Enterprise Server 11 (x86_64)
    /usr/sap/HAN/HDB00> HDB help
    Usage: /usr/sap/HAN/HDB00/HDB { start|stop|reconf|restart|version|info|proc|admin|kill|kill-<sig>|term }
      kill or kill-9 should never be used in productive environment!
    /usr/sap/HAN/HDB00> HDB info
    USER       PID  PPID %CPU    VSZ   RSS COMMAND
    hanadm   14682 14677  0.0  85580  2180 sshd: hanadm@pts/0
    hanadm   14683 14682  3.3  16768  2980  \_ -bash
    hanadm   14756 14683 18.1  13652  1680      \_ /bin/sh /usr/sap/HAN/HDB00/HDB info
    hanadm   14782 14756  0.0   6620   892          \_ ps fx -U hanadm -o user,pid,ppid,pcpu,vsz,rss,args
    hanadm   31638     1  0.0  42624  1820 sapstart pf=/usr/sap/HAN/SYS/profile/HAN_HDB00_vml3012
    hanadm   31645 31638  0.0 528216 151400  \_ /usr/sap/HAN/HDB00/vml3012/trace/HDB.sapHAN_HDB00 -d -nw -f /usr/sap/HAN/HDB00/vml3012/daemon.ini pf=/usr/sap/HAN/SYS/profi
    hanadm   31665 31645  0.5 5001972 1002844      \_ hdbnameserver
    hanadm   31723 31645  0.0 4367024 244336      \_ hdbpreprocessor
    hanadm   31744 31645  1.9 5664496 1779448      \_ hdbindexserver
    hanadm   31752 31645  3.6 7197924 3359440      \_ hdbstatisticsserver
    hanadm   31759 31645  0.6 5289164 1507684      \_ hdbxsengine
    hanadm   32017 31645  0.0 429188 124344      \_ sapwebdisp_hdb pf=/usr/sap/HAN/HDB00/vml3012/wdisp/sapwebdisp.pfl -f /usr/sap/HAN/HDB00/vml3012/trace/dev_webdisp
    hanadm   31527     1  0.0 292676 110380 /usr/sap/HAN/HDB00/exe/sapstartsrv pf=/usr/sap/HAN/SYS/profile/HAN_HDB00_vml3012 -D
    > * Does Hana DB started with SAP start profile? If so, could someone point me to the example of such a profile?
    ?? seriously... take a guess
    regards,
    Lars

  • DOS/Windows command in app server

    I don't know if this is the correct forum.
    I want to know if there is a t-code or report to execute a DOS/Windows command in the application server.
    thanks all in advance.

    Hello Mauro,
    you can define an external command in SM69.
    Regards
    Gregor

  • Executing dos TYPE command Failure

    I am trying to execute the dos TYPE command from within Java. But I would like the output to go to a file, not to the screen. The following program sends the output to the screen, but not to the specified file. Why?
    It does actually create the file I want but it is empty.
    import java.io.*;
    class ExecuteCommand
         public static void main(String[] a) throws IOException
         Runtime rt = Runtime.getRuntime();
         Process p = rt.exec("cmd /c start type d:\\java\\billing\\test66.java>d:\\java\\billing\\outputFile.txt");
    Many thanks
    Akz

    Try this:
    Process p = rt.exec(new String {} { "cmd","/c","start","type" ,"d:\\java\\billing\\test66.java", ">d:\\java\\billing\\outputFile.txt" } );

  • Populating MX:Tree with Directory Structure using PHP

    Hello,
    I have written the following php function to return the directory structure :
         public function get_dir_iterative()
              $dir = 'data';
              $exclude = array( 'cgi-bin', '.', '..' );
              $folders = '<?xml version="1.0"?>';
              $folders .= "<node label='Root' path=\"data\">";
              //$folders .= $this->getFolderRecuring("data");
              $exclude = array_flip($exclude);
              $dh = opendir($dir);
              //$stack = array($dh);
              //$level = 0;
                        //closedir(array_shift($stack));
              while(count($stack))
                   if(false !== ( $file = readdir( $stack[0] ) ) )
                        if(!isset($exclude[$file]))
                             if(is_dir($dir . '/' . $file))
                                  $dh = opendir($dir . '/' . $file);
                                  if($dh)
                                       $folders .= "<node label=\"$file\" path=\"$dir/\" isBranch=\"true\" />";
                                       array_unshift($stack, $dh);
                                       ++$level;
                             else
                                  $folders .= "<node label=\"$file\" path=\"$dir/\">";
                   else
                        closedir(array_shift($stack));
                        --$level;
              $folders .= "</node>";
              return $folders;
    When I test this function manually it returns the proper structure.
    But when I call it with help of ZendAMF there is nothing returned and the sandclock is spinning infinite ?!
    here is the flex part:
    private var fms:RemoteObject = new RemoteObject();
    protected function initFileManagerService():void
         fms.destination ='zend';
         fms.source='FileManagerService';
         fms.showBusyCursor=true;
         fms.addEventListener( FaultEvent.FAULT, faultListener);         
         fms.get_dir_iterative.addEventListener( ResultEvent.RESULT, load_result );              
         trace('FileManagerService initialized');
    public function load():void
         fms.get_dir_iterative();
         trace('Service / load');
         private function load_result( e:ResultEvent ):void
              trace('result:'+e.result)                   
    My zend setup is working, any idea what could be wrong ?

    >if you comment out the php and just return "hello" do you get it back in flex?
    Jip, thats working
    >is this line right?>fms.get_dir_iterative.addEventListener( ResultEvent.RESULT, load_result );
    Yes it is correct, thats the way you listen for a result of a specific function when using the zend framework.
    I have other projects running very good like this.
     

  • Directory structure for a J2SE+J2EE project: suggestions are very welcome

    Hi, I have to start coding and organizing the CVS tree of an already mature project which is J2SE. This J2SE project can be described as a "core engine" for something else, and is a quite large project, and up to now has only a command line User Interface. I organized the dir structure as this:
    /build.xml
    /src/
    /src/java/<package>/...../*.java
    /src/demo/<package/...../*.java
    /src/test/<package>/....../*.java
    when I ant compile, all the .classes will be done in the "build" directory (reflecting the structure in the "src" dir):
    /build/
    /build/java/<package>/....../*.class
    /build/demo/<package/...../*.class
    /build/test/<package>/..../*.class
    I am happy with this, but now comes the issue: a web interface to use this core engine (it will have the same package namespace) is in developing progess, so I have to put somewhere the *.jsp, the WEB-INF dir with web.xml and servlet sources: how would you do this? And where would you let Ant put the compiled servlet classes?
    I can modify the previous directory structure to accomodate the J2EE part, this is really not a problem!
    Thanks to who can suggest me a clean solution
    Alessio

    Create a web-inf folder at the same level of src and
    jsp folder inside src
    i mean
    /build.xml
    /src/
    /src/java/<package>/...../*.java
    /src/demo/<package/...../*.java
    /src/test/<package>/....../*.java
    /src/jsp
    /web-infSo, would you put in /src/jsp only the *.jsp?
    And what in /WEB-INF ? What woud you put there? Would you do something like:
    /WEB-INF/web.xml
    /WEB-INF/src/<package>/..../<my_servlets_and_j2ee_stuff>.java
    /WEB-INF/classes/<package>/..../<my_servlets_and_j2ee_stuff>.java
    In this manner sources and classes are in the same tree, it does not seem very clean to me, expecially if you consider that probably I must have a "test" directory to unit test some j2ee stuff (as for the j2se stuff in "src"): how would you do that?
    Is this directory structure anyway what you meant or not?
    alessio

  • Directory structure of JMS application

    either we must follow any directory structure just like servlets and ejb as web-inf and meta-inf in JMS.

    No real need - just use the JMS client directly in any JVM.
    If you are using MDBs then yes you need to use an EAR just like EJBs - but alternatively just use spring.xml...
    http://jencks.org/Message+Driven+POJOs
    James
    http://logicblaze.com/
    Open Source SOA

  • Changing file name and directory structure for use outside of iPhoto

    Hi,
    I was wondering if its possible to get iPhoto to name the files from my library to reflect the names that I've given the files in iPhoto. I'm thinking along the lines of iTunes, where its possible to chose in the preferences how the files are named, and there is some logical directory structure, such as "Artist/Album/01 - Track 1.mp3". These file names are updated to reflect any changes made in iTunes.
    I've heard the argument that I shouldn't ever want to do anything with the files themselves because iPhoto can do everything I would ever want to do, but I want to organize the files so that not all of my organizational work is lost if I decide to stop using iPhoto and transition to a different system. Any suggestions would be appreciated.
    Thanks,
    Adrian

    Adrian
    No it's not possible.
    You can rename the files before bringing them into iPhoto, you can rename them with the titles on Export (Use the File -> Export command, it gives you the option to use the title and filename) but when it's inside iPhoto you cannot rename the files.
    However, all is not entirely lost. Using Film Rolls (View -> Film Rolls) you can move pics between rolls, name rolls, create rolls and so on, as long as you do this in the iPhoto Window, and these changes will be reflected in the iPhoto Library Folder.
    If at some point you decide to chuck iPhoto then (if the new app won't read iPhoto database files) you can simply export each album you've created to a Folder (using the File -> Export command as I suggest above), this, along with exporting slideshows will preserve your organisational efforts.
    The iTunes database has a rather simple job to do: track a file and it's assorted metadata. iPhoto, on the other hand, tracks a file and it's assorted metadata, plus a Modified version, plus a thumbnail. If you consider what happens when you edit a pic, for instance - Copy Original, perform edit, save modified version, remove Original Thumbnail and then create new one - you can see it's a rather more complex job.
    Finally, the standard warning: It is strongly advised that you do not move, change or in anyway alter things in the iPhoto Library Folder as this can cause the application to fail and even lead to data loss. Any changes you make must be made in the iPhoto Window.
    Need more info? by all means post again.
    Regards
    TD

  • PC - Moving catalog and directory structure to a new HD

    Having filled my internal HD with images, I went out and purchased a new and bigger external hard drive. I want to move my images to the new drive while preserving both my directory structure and catalog information. From what I can see of the "move" command in PS Elements, it moves selected images to a new directory, but that's not what I want to do. I probably have a hundred named folders and I would like to keep the images in folders of the same name on the new drive. I don't want to have to move one directory at a time. Copying through the file manager can obviously do this, but I don't know if it will preserve my tags, etc.
    Is there a straightforward way to move files from one drive to another that preserves both directory structure and catalog information?
    Thanks in advance.
    Artie

    Humm, this is strange-Version 4 is supposed to move entire folders; Version 3 did not do this.
    Okay, Plan B.
    Open Elements and do a Full Backup and point to your external hard drive.
    When this has finished running, do a Restore. You should get a pop up asking if you want to use the existing folder structure. Answer Yes and point to your External HardDrive (EHD). This should copy your photos and the Organizer file over to your (EHD).
    Now look in Preferences under Files (I think, don't have program open) and you will see one value for where to store photos and one for Organizer location. Change these to your EHD so future photos and tags/collections are written to the EHD.
    Verify all your tags and collections came over correctly.
    If you are satisfied the transfer went correctly, you can erase your photos from your hard drive to free up space. You can also delete the Organizer file if you want.
    Option 2-Use Windows Explorer and move all the files from your hard drive to your EHD. This will keep your folder structure, but will cause havoc with Organizer.
    Open Organizer and do File>Reconnect All Missing. It will be all of them. You should have an option to change the drive to your EHD. It may take quite a while to reconnect all of them, but since all the folders/files are the same name it should find them all.
    If you wish, you can change the drive location manually. However, I've found many users 1) do not have MS Access on their machine and 2) are not experienced in using the program. If you are comfortable with the program, let me know and we'll get some directions.
    Finally, I see a copy of the post in the Technical side. Since most forum users read both sides of this forum, I'm going to reference this thread in that post so anyone can see what we have tried so far.

  • Package and Directory Structure

    Hello --
    I work in a group that supports 3 web sites. (b2b, b2c, b2e)
    We're just beginning to develop Java in-house and
    currently using Solaris and JDK 1.2.x.
    I need to propose a package and directory structure strategy.
    The "reverse the domain name" guideline makes sense to me.
    My first thoughts are: ("classes" dir could be created anywhere)
    classes/com/ppco/b2X/ <--- for .java and .class files (development)
    lib/ <--- for b2X JAR files (ready for test or production)
    util/ <--- for our utility classes like DBAccessor
    lib/ <--- for our JAR files
    sun/ <--- for classes like com.sun.mail pkg
    lib/ <--- for JAR files like mail.jar
    org/ <--- for classes in org.omg.CORBA pkg
    lib/ <--- for JAR files
    We need to handle 3rd party classes.
    Development would be done in the b2X tree and JAR files would
    be installed the lib/ dir for testing and release to production.
    Does anyone have recommendations or experiences to share ?
    Are there some things to avoid ?
    Thanks !
    Al

    Hello Al,
    you are on the right track. A typical convention I follow is:
    <project>
          bin - for startup scripts, etc. to run your application
          build - for build scripts (not necessary if you build using your IDE. See below.)
          classes - for my compiled classes
          lib - for my 3rd party libraries
          src - for my source code
          test - for my test code (see http://junit.org/ )
    That's the project hierarchy. The src (i.e. the package heirarchy) structure is another story.
    As you say, you start with the reverse domain name. This is to give your packages a unique namespace. After that, your best guide is practice. Packages can be larger or smaller, depending on your coding practices. Usually you would have these (exact names may differ), plus others:
          com/ppco/client
          com/ppco/server
          com/ppco/common
          com/ppco/db
    I think your break down of sun, org, etc. is a bit too much. If you would like to do so, however, I recommend you do the separation under /lib. This way, the top level project directory is not polluted by the different types of libraries in use.
    Regards,
    Manuel Amago.
    From build above: I would suggest you always build your release distribution directly with the JDK, not using any IDE compiler. This is because Sun's JDK is the reference implementation, thus, any compatibility issues are not yours.
    An easy way to achieve this is by using ANT (see http://jakarta.apache.ort/ant/ ).

Maybe you are looking for

  • Error while installing SAP MMC

    Hello All, Iam trying to install SAP MMC where Windows userid/pwd  to be created is SAPServiceF03/abc123. In my company because of the password security policy I cant create a password abc123 for the windows OS user SAPServiceF03. The installer abort

  • Getting an error when testing the payment flow. Can you please help me?

    I'm getting this when testing a payment flow: What do do? Thanks in advance, Diego.

  • Flash Video Doesn't Work

    I'm having serious problems inserting Flash Video into my site (and I have uploaded the script folder and file). Background: I'm fairly experienced with most software, but I am totally new to web creation/web software. Code is above my head. I create

  • Context Menu besides user name

    Experts, Please let me know how to hide the context menu near user name.  Thanks

  • BPMon alert reporting not showing any data for Trend Analysis

    Hi, I have setup BPMon and performed the initial setup for BW reporting. There are alerts being generated by the BPMon setup and the data has been transferred to the 0SM_BPM cube. But when I start the Trend Analysis report I dont get any Solution for