IBM i Global

 View Only
  • 1.  Copy selected files from one IFS folder to another

    Posted Wed August 14, 2024 07:50 AM

    Hello

    I have an IFS folder containing around 320.000 files.
    I need to select some of them depending on last modified date and content, and then copy them to another folder. Then I'll zip and export that folder.
    The number of files in the result is around 24.000 for 124 MB.

    I tried first with Agent Ransack. I could find the files, but then I can only copy bunches of few files from the result windows. Not usable.

    Then I tried QSHELL with the following command in a CL:
    cp $(find /folder1 -type f -mtime -8 -mtime +5 | xargs grep -l 'TEXT1[[:space:]][[:space:]]TEXT2') /Folder2/
    It works when I test on a folder1 containing few files.
    But then I get error message : qsh: 001-0078 Process ended by signal 5.
    I understand that this is due to a QSHELL limitation in the arguments number when passing from one command to another.

    Has someone an idea about how I can achieve the copy of the files ?
    This is a one time job. So I won't buy a tool for this. Either I can with what I have or I can't.



    ------------------------------
    Denis Roche
    ------------------------------


  • 2.  RE: Copy selected files from one IFS folder to another

    Posted Wed August 14, 2024 09:21 AM
    Edited by Satid S Wed August 14, 2024 09:23 AM

    Dear Denis

    >>>> But then I get error message : qsh: 001-0078 Process ended by signal 5. I understand that this is due to a QSHELL limitation in the arguments number <<<<

    Did you use a default or maximum value for supported file descriptor of Qshell?  If the default one, you can try expanding it to the max value supported. I hope this Technote should be of help to you in this matter: File Descriptor Limits In the Qshell and PASE Environments at https://www.ibm.com/support/pages/file-descriptor-limits-qshell-and-pase-environments      



    ------------------------------
    Satid S
    ------------------------------



  • 3.  RE: Copy selected files from one IFS folder to another

    Posted Thu August 15, 2024 02:58 AM

    Thank you for your answer Satid. But unfortunately, changing the file descriptor limit didn't help.

    But this morning I read again https://www.ibm.com/support/pages/argument-number-limits-ls-rm-and-other-qshell-commands-qsh-001-0078-process-ended-signal-5

    I could see that the limit is 16383 arguments.

    So I changed the limits for mtime to select less files, and I run the job several times. That way it worked.



    ------------------------------
    Denis Roche
    ------------------------------



  • 4.  RE: Copy selected files from one IFS folder to another

    IBM Champion
    Posted Wed August 14, 2024 10:22 AM

    tar cf - * | (cd mydir; tar xfp -)

    Old Unix hack. Should work in PASE.

    You may have to fiddle with it if you have dot-files (.foo etc ..).



    ------------------------------
    Jack Woehr
    ------------------------------



  • 5.  RE: Copy selected files from one IFS folder to another

    Posted Thu August 15, 2024 03:02 AM

    Thank you for you input Jack. I solved my issue by narrowing my selection and running several jobs.



    ------------------------------
    Denis Roche
    ------------------------------