ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

FTP - HELP PLEASE - *** Delete PC file after downloading ***

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

  • FTP - HELP PLEASE - *** Delete PC file after downloading ***

    Experts,
    Below is my part of my FTP command, I wanted to delete the PC files that I have downloaded.

    I do not want to use MDELETE or any commands that delete all files in the entire directory.

    The reason because, at the time of deleting , I am afraid, there may be some new files might have been put into the directory.

    So, I wanted to delete only the files that I have downloaded.

    There is no specific naming conventions used in the files... ( unless, if I can rename the PC files on the FTP command, and download those, and issue a delete command with spefic naming convention that I have renamed... not a bad option.. )

    ls *.* (disk
    prompt
    lcd /QOpenSys/PCFILESD
    mget *
    quit

    Thank You
    StillIn400

  • #2
    Re: FTP - HELP PLEASE - *** Delete PC file after downloading ***

    For the same reason I wouldn't do MDEL, I also wouldn't do MGET. Instead, consider this approach:

    1) Connect and do LS (disk.
    2) Have a program that generates a new FTP script in a temp file. Read the LS output, write a script that does GET <filename> DEL <filename> for all files in the LS output
    3) Run this new script.

    Unfortunately, if using the clumsy IBM "batch FTP" method, this does require disconnecting after the LS output, and running a separate FTP script to get/delete the files. You may want to use a tool like FTPAPI to make this easier.

    Comment


    • #3
      Re: FTP - HELP PLEASE - *** Delete PC file after downloading ***

      Originally posted by Scott Klement View Post
      For the same reason I wouldn't do MDEL, I also wouldn't do MGET. Instead, consider this approach:

      1) Connect and do LS (disk.
      2) Have a program that generates a new FTP script in a temp file. Read the LS output, write a script that does GET <filename> DEL <filename> for all files in the LS output
      3) Run this new script.

      Unfortunately, if using the clumsy IBM "batch FTP" method, this does require disconnecting after the LS output, and running a separate FTP script to get/delete the files. You may want to use a tool like FTPAPI to make this easier.

      Comment


      • #4
        Re: FTP - HELP PLEASE - *** Delete PC file after downloading ***

        Thank You so much Scott for your quick reply.

        I know FTP is one of your favorite subject.

        I will try the approach you have mentioned and keep you posted.

        I am afraid to go FTPAPI as I may have to spend more time on learning.

        I will try the approach you have mentioned.

        Thanks
        StillIn400

        Comment


        • #5
          Re: FTP - HELP PLEASE - *** Delete PC file after downloading ***

          Thanks Scott.
          The approach you mentioned worked cool.
          Sorry I didn't visit code400 for quite some time.
          Thanks again
          StillIn400

          Comment

          Working...
          X