ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to get IFS directory and sub-directory content

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to get IFS directory and sub-directory content

    Hi All,

    I am looking for such FTP command that gives me list of all directory and sub-directory contents.
    for example, my directory contains following -

    javadir1/javadir2/javadir3/file.txt
    coboldir1/coboldir2/file.pdf
    cdir1/cdir2/cdir3/cdir4/cdir5/file.pdf

    Command dir or ls gives output but the problem with these command is it gives upto 1 level of the directory content like following -

    dir cdir1/*.*
    Output of above command is cdir1/cdir2/ but here cdir3..5 available but not listing.

    So I want such command that gives me all the directory and sub-directory contents till the end. So my output would be
    dir cdir1 then output would be "cdir1/cdir2/cdir3/cdir4/cdir5/file.pdf" this way I do not need to go each and every directory to get all the directory and sub-directory contents. So for every directory "javadir1" or "coboldir1" or "cdir1" it should show all the sub-directory contents.

    Is there way to get this done...!!!
    Cheers...
    Nil

  • #2
    Re: How to get IFS directory and sub-directory content

    look here http://www.code400.com/forum/showthr...ght=ftp+output
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

    Comment


    • #3
      Re: How to get IFS directory and sub-directory content

      Originally posted by DeadManWalks View Post
      Thanks for your post but I am looking some different thing than mentioned in the above link.
      I need to get the complete path till the end for any directory. So if there is directory called javadir1 that contains several directories and sub-directories. So if javadir1 contains like following -
      javadir1/javadir2/javadir3/javadir4/javadir5/BillStatements.PDF

      Then if I use dir or ls command it is not displaying full path till "BillStatements.PDF" it just shows "javadir1/javadir2/" but there are javadir3..5 available so how do I find or list all the complete path using any command?
      Cheers...
      Nil

      Comment


      • #4
        Re: How to get IFS directory and sub-directory content

        I don't believe there is anything out there that does what you are looking for. Everything I have seen just lists the contents of a single directory. You are most likely going to have to write a program or script that that will list the parent directory then cycles through each of it sub directories, etc... until you have listed all of them. This is probably a little bit more work than you wanted to do but it shouldn't be that difficult to create.

        Comment


        • #5
          Re: How to get IFS directory and sub-directory content

          Is it necessary to use FTP?
          Tom

          There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

          Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

          Comment


          • #6
            Re: How to get IFS directory and sub-directory content

            Originally posted by tomliotta View Post
            Is it necessary to use FTP?
            QSH or QSHELL is another option available for me apart from FTP, so is there any possibility using QSH (QSHELL)?
            Cheers...
            Nil

            Comment


            • #7
              Re: How to get IFS directory and sub-directory content

              Sorry... What I should have clarified is that it's not clear what the server and client systems are.

              It seems that one of those is an AS/400-series system. It's not clear at all what the other is. Are you running FTP from your "AS/400" to some (remote?) system and wanting to have it create a file/document of the full tree structure of the target directory? Or are you making a FTP request from your PC to your server and trying to retrieve the list? Or are both systems the same type? Or are you just running FTP back to the target system just to find a way to get the full needed list...? Something else...?

              Depending on what kind of system is making a request to whatever other kind of system, there might be alternatives. Maybe FTP isn't the right tool, but it's hard to know what else might help.
              Tom

              There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

              Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

              Comment


              • #8
                Re: How to get IFS directory and sub-directory content

                Originally posted by tomliotta View Post
                Sorry... What I should have clarified is that it's not clear what the server and client systems are.

                It seems that one of those is an AS/400-series system. It's not clear at all what the other is. Are you running FTP from your "AS/400" to some (remote?) system and wanting to have it create a file/document of the full tree structure of the target directory? Or are you making a FTP request from your PC to your server and trying to retrieve the list? Or are both systems the same type? Or are you just running FTP back to the target system just to find a way to get the full needed list...? Something else...?

                Depending on what kind of system is making a request to whatever other kind of system, there might be alternatives. Maybe FTP isn't the right tool, but it's hard to know what else might help.
                The two server will be AS400 servers only in which I am connecting, so both are iSeries servers.
                Cheers...
                Nil

                Comment


                • #9
                  Re: How to get IFS directory and sub-directory content

                  In that case, depending on your network, you might create a /QFileSvr.400 directory to link to the remote system by IP address or host name, and list that. Or /Qntc might work if a shared directory exists that leads to your directory. Or you might create a NFS export. The QSH ls utility could work with any of those; the -R option will recursively list sub-directories.

                  Other possibilities exist. Remote commands vie rexec() or perhaps RUNRMTCMD can be easy enough.
                  Tom

                  There are only two hard things in Computer Science: cache invalidation, naming things and off-by-one errors.

                  Why is it that all of the instruments seeking intelligent life in the universe are pointed away from Earth?

                  Comment


                  • #10
                    Listing ifs files, including recursive directories.

                    It's easy using the qshell find utility. Here's an example.

                    strqsh cmd('touch -C 1252 /myDirectory/myList.txt ; find /tmp -print >> /myDirectory/myList.txt')

                    The first utility, touch, is optional, it just creates a file in the PC ccsid, the second lists all the files including subdirectories recursively into the file. The find command is very powerful and does a lot of other things as well. Here is a link to an excellent article by Tom Snyder on using QShell to purge the ifs. http://www.mcpressonline.com/rpg/use...matically.html

                    Comment

                    Working...
                    X