ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

Using QSHELL to get total size of IFS folder

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

  • Using QSHELL to get total size of IFS folder

    This command will create a member in source file source in library jamielib.
    Within this source member will be the total size of IFS object(s)


    Code:
    QSH CMD('ls -l /home/jamie/ >                 
    /qsys.lib/jamielib.lib/source.file/mbr1.mbr')

    List all folders under root/home in the IFS

    Code:
    QSH CMD('ls -l /home/                            
    > /qsys.lib/jamielib.lib/source.file/mbr2.mbr')
    What you see
    Code:
    total: 84 kilobytes                                                                
    drwxrwsrwx   2 DAILYCHECK  0                  8192 Sep 30  2003 Accounting         
    d---rws---   2 QSECOFR     0                  8192 Feb 22 07:01 HR                 
    drwxrwsrwx   3 QSECOFR     0                  8192 May  4  2004 Kronos             
    d---rwsrwx   2 SRC         0                  8192 Jan 13 09:07 PDFs               
    drwxrwsrwx   2 FLANARY     0                 12288 Mar  2 08:47 jamie              
    drwxrwsrwx  60 FLANARY     0                 40960 Feb 28 10:15 source_archive

    list all tables in folder /home/source_archive/WKR25
    Code:
    QSH CMD('ls -l /home/source_archive/WKR25   >
    /qsys.lib/jamielib.lib/source.file/mbr4.mbr')

    What you see
    Code:
    total: 576 kilobytes                                                                                 
    -rw-------  1 FLANARY  0                 93184 Feb 21 11:35 FLANARY2005-02-21-11.35.26.262000.txt    
    -rw-------  1 FLANARY  0                 93184 Feb 21 12:14 FLANARY2005-02-21-12.14.55.065000.txt    
    -rw-------  1 FLANARY  0                 93184 Feb 21 12:36 FLANARY2005-02-21-12.36.53.071000.txt    
    -rw-------  1 FLANARY  0                 93184 Feb 21 12:41 FLANARY2005-02-21-12.41.30.104000.txt    
    -rw-------  1 FLANARY  0                 93184 Feb 21 12:49 FLANARY2005-02-21-12.49.49.543000.txt    
    -rw-------  1 FLANARY  0                 93184 Feb 21 12:52 FLANARY2005-02-21-12.52.06.016000.txt
    All my answers were extracted from the "Big Dummy's Guide to the As400"
    and I take no responsibility for any of them.

    www.code400.com

  • #2
    Re: Using QSHELL to get total size of IFS folder

    Is there anyway to get the list of tables in a directory into a physical file?

    Comment


    • #3
      Re: Using QSHELL to get total size of IFS folder

      Welcome Rodney,

      Sure there is just modifiy this program to write to physical rather than subfile



      Take care
      Jamie
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Re: Using QSHELL to get total size of IFS folder

        Originally posted by Rodney
        Is there anyway to get the list of tables in a directory into a physical file?
        I don't know what courtesy here is on bumping old threads, so I apologize if I've crossed any lines...

        Here is how I like to accomplish this in a CL program that is pretty nifty and short on lines of code.

        Code:
        /* Build command */
                     chgvar     var(&COMMAND) value('ls > /qsys.lib/' *tcat +
                                  &LIB *tcat '.lib/ED0100P.file/' *tcat +
                                  &MBR *tcat '.mbr')
        
        /* Issue QSHELL command to list IFS folder contest to work file */
                     cd         dir('\ftp\snyder')
                     qsh        cmd(&COMMAND)
        Basically, the command is:

        ls > /qsys.lib/library.lib/filename.file/membername.mbr

        Obviously, I've passed in the values to build the command to work in different libraries (test vs. production, mainly) and the member name was generally created on the fly.

        Issuing the 'cd' command prior to the 'qsh' is important if you do it this way because it'll give you the contents of the current directory.

        Comment


        • #5
          Re: Using QSHELL to get total size of IFS folder

          Looks nice.....Thanks for the Tip..

          If I havent said it yet...Welcome to code400.

          Let me know if there is anything I can do for you.

          take care
          jamie
          All my answers were extracted from the "Big Dummy's Guide to the As400"
          and I take no responsibility for any of them.

          www.code400.com

          Comment


          • #6
            Re: Using QSHELL to get total size of IFS folder

            cant believe jamie came up with that...its been on my mind too

            i did get the part about ls, which works fine and moving it to a member..

            i have been pulling my hair out to list the objects in a certain library (*.LIB) and i did use the following command

            QSH CMD(find /qsys.lib/ -name '*.LIB /qsys.lib/mylib.lib/allfile.file/allfile.mbr')

            allfile is a flat physical file i created. it thought for a long time and spit out an error message. i went back to using WRKOBJ OBJ(MYLIB/*ALL) OBJTYPE(*LIB)

            anyway if someone knows a way to make it work, thats great..

            a little info i bumped into to keep ur files safe and ur library safe...
            chmod u=rwx myfile.file
            chmod o=r mylib.lib
            thought it was cool. ofcourse you use this chmod inside qshell.

            Comment


            • #7
              Re: Using QSHELL to get total size of IFS folder

              Y not use this bad boy

              All my answers were extracted from the "Big Dummy's Guide to the As400"
              and I take no responsibility for any of them.

              www.code400.com

              Comment


              • #8
                Re: Using QSHELL to get total size of IFS folder

                i could...thanks...

                but u know i am starting to get attracted to qshell...lol

                Comment


                • #9
                  Re: Using QSHELL to get total size of IFS folder

                  Originally posted by jamief
                  Looks nice.....Thanks for the Tip..

                  If I havent said it yet...Welcome to code400.

                  Let me know if there is anything I can do for you.

                  take care
                  jamie
                  Thanks, I just need to spend more time here. I am sure there is plenty I can learn.

                  Comment

                  Working...
                  X