FTP without file deletion

Clovertech Forums Read Only Archives Cloverleaf Tcl Library FTP without file deletion

  • Creator
    Topic
  • #51678
    LaToya Butler
    Participant

      I am attempting to retrieve a file from a remote server where the filename contains the current date.  However, I want the file to remain on the server.  I do not want CL to delete it.  Looking a several threads, I need to create a directory parse or deletion tcl proc to accomplish this.  Does anyone have a proc they are willing to share?

    Viewing 7 reply threads
    • Author
      Replies
      • #71239
        Michael Hertel
        Participant

          Place hcitpsmsgkill in the deletion tps

        • #71240
          Jim Kosloskey
          Participant

            Michael,

            I don’t think that will do the trick because there is no message at that point only the name of the file that will be deleted as each file is finished being read.

            email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

          • #71241
            Michael Hertel
            Participant

              I should have been more concise.

              In order to accomplish:

              Quote:

              However, I want the file to remain on the server.  I do not want CL to delete it.

              Place hcitpsmsgkill in the deletion tps

            • #71242
              Charlie Bursell
              Participant

                Still won’t work Mike.

                Put in a deletion proc that always returns an empty list.

                This proc is similar to the directory parse proc.  It gives you a list of files it proposes to delete and you return a list you want it to delete. The main difference here is you are provided the complete path.

                I guess my question is if you don’t delete it what will keep you from processing it over and over?

              • #71243
                Michael Hertel
                Participant

                  Not to beat a dead horse, but…

                  I am on 5.4.1 AIX

                  My understanding and past use has been that this still is a point of control that gives you a message handle to a message that contains a list of files it proposes to delete. Similiar to what you said.

                  If we return a KILL disposition, no list goes through and therefore,

                  nothing to delete.

                  What am I missing? Is this something that has changed with the introduction of tclcurl in 5.5+ versions? Or have I been smoking something other than cigarettes while working?

                • #71244
                  Charlie Bursell
                  Participant

                    Nothing has ever changed with Fiieset Delete.  It works the way it always has.

                    Here is a simple delete proc.  Set up a test Fileset/Local or FTP thread and put it in there then look at the log file.

                    Also note, as I said you will process the same file over and over.

                    The purpose of this, for Fileset/Local only would be to give you the opportunity to archive the files rather than delete them.  FOr FTP you don’t have the access

                    Code:


                    proc fdelete {args} {

                       keylget args MODE mode              ;# What mode are we in

                       switch -exact — $mode {
                           start {

                               return “”   ;# Nothing specific
                           }

                           run {

                               keylget args MSGID mh

                               set lst [msgget $mh]

                               echo nnDELETE LIST:
                               foreach fn $lst {echo t$fn}
                               echo nn

                               msgset $mh “”
                               return “{CONTINUE $mh}”
                           }
                       }
                    }

                  • #71245
                    LaToya Butler
                    Participant

                      I’m using advance scheduling to run only once a day and I have a directory parse proc to only pull the file with the current date but the files were being deleted.  I did not want this.  With this, is there still a chance for the file being processed over and over.

                    • #71246
                      Charlie Bursell
                      Participant

                        If you do not remove the file from the  directory and it has the same name the engine will process it over and over.

                        If it only processes the file with current date and it only runs once per day, it should be OK since each time it runs it is looking for a different file name

                        If it were me, to be sure, I would set a non-volitle flag somewhere to indicate I had already processed the file.  

                        For example, you could simply write a zero-length file of the same name in a local directory.  Then before you tell the engine to fetch that file check to see if it exists on the local directory,  If not fetch.  If so, ignore.  Also, when checking the local file, delete any older than today to keep them from accumulating.

                        There are other methods, of course

                        Use a proc similar to the one I posted and have it return the empty list and it will not delete

                    Viewing 7 reply threads
                    • The forum ‘Tcl Library’ is closed to new topics and replies.