ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

How to create subdirectories in IFS

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

  • How to create subdirectories in IFS

    Hi,


    How to create subdirectories into a specific folder and directory in IFS in AS/400?



    Thanks...

  • #2
    Creating directories on IBM i is pretty much the same way you do it on any platform.

    Either change your current directory to the target one and create the new directory.

    Or create the new directory by including the required path. e.g targetDirectory/newDirToCreate

    Comment


    • #3
      i created one subdirectory using command like as :-md '/home/jkjk1/s1'

      but in s1 subdirectoy i find endless chain of * and ** subdirectories how they got created ?

      Thanks..

      Comment


      • #4
        Those normally just indicate higher level directories but . and .. is how they normally show - on wrklnk for example.

        If processing a directory programatically it is normal to just ignore them.

        Comment


        • #5
          Thanks...But is there any way by which we could quickly search for specific keywords in all the available directories,subdirectories in the system?



          Thanks...

          Comment


          • #6
            What do you mean? Do you want to get all files with a specific name or attribute (for example .json) or do you need to search the content of the IFS files?
            In both situations I'd suggest SQL and using the IFS_OBJECTSTATISTICS Table function:
            In the following example the directory '/home/Hauser' (with all subdirectories) is searched to find all files endign with .json:
            Code:
            Select Path_Name, Object_Type,
            Create_Timestamp, Access_Timestamp, Last_Used_Timestamp, Days_Used_Count
            From Table(QSYS2.IFS_OBJECT_STATISTICS('/home/Hauser')) x
            Where Right(Trim(Path_Name), 5) = '.json'
            If you want to search the content, you may additionally use the GET_CLOB_FROM_FILE Function (Attention: must be executed under Commitment Control)
            The follwoing example searches through all files ending with .json but returns only the files that include somewhere 'FirstName'.
            Code:
            Select Path_Name, Get_Clob_From_File(Path_Name) "IFS File Content"
            From Table (Qsys2.Ifs_Object_Statistics(Start_Path_Name => '/home/Hauser',
            Subtree_Directories => 'YES',
            Object_Type_List => '*ALLSTMF')) x
            Where Right(Trim(Path_Name), 5) = '.json'
            and Get_Clob_From_File(Path_Name) like '%FirstName%'
            Order By Path_Name ;

            Comment


            • #7
              In a QSH sesssion I use the command locate for that (google will help you to get more informaion about this command).
              If it's not available and YUM is installed on you system, you can install it via: yum install findutils

              Comment


              • #8
                Thanks , I just wanted to search or specific keywords ( which have some specific directory and subdirectory names) in all the available directories,subdirectories in the system so that i could avoid manual search for intended directory and subdirectories when we issue command WRKLNK.

                Is there anyway to achieve this?


                Thanks much...



                Comment


                • #9
                  Here is an article about the SQL IFS_OBJECT_STATISTICS function . https://www.rpgpgm.com/2019/11/using...and-files.html

                  Here is the documentation for the function: https://www.ibm.com/docs/en/i/7.4?to...table-function

                  In your SELECT, you could add a WHERE clause to only return the path names with the required keyword.

                  Edit: Sorry Birgitta. I didn't notice that you had already posted about this SQL function.

                  Comment

                  Working...
                  X