Sponsored Links
Sponsored Link

sponsored links

Collapse

Announcement

Collapse
No announcement yet.

sFTP and continuation character

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

  • sFTP and continuation character

    Hello good folks.

    I am using the sFTP client on the ibm I and i am not sure what server I am connecting to. Any way the issue is with the "" continuation character. I am using it in a script and tried interactively and it is not working.

    Ex:
    Code:
    CD /br/po/outbox                          
    Rename order-2016-05-19-10-35-05-931.xml \
    archive/order-2016-05-19-10-35-05-931.xml
    I get the following error; "Couldn't rename file "/br/po/outbox/order-2016-05-19-10-35-05-931.xml" to "/br/po/outbox/": Failure".

    I am curious if there is some setting on the client side when starting sFTP to say what is the continuation character. I know in FTP is the + sign.

    Thanks, DMW.
    Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

  • #2
    I assume you are referring to the sftp tool that comes with OpenSSH. If not, please say so ;-)

    Next question is whether you are using Expect to control sftp, or using sftp's built-in -b batchfile option?

    Final question (I promise!) since the commands are not kept in a stream file rather than a fixed-length, record-based file, is there really a need to continue on the next line? After all, the lines can be as long as you like...

    Comment


    • #3
      I am using strqsh.
      i am using the -b
      I am trying to utilize the existing database behind our ftp application and it is only so long, not long enough, hence trying to use the continuation character.

      Thanks.
      Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

      Comment


      • #4
        Okay... I'm pretty sure there is no continuation charaqter for a -b batchfile. That leaves 3 possibilities:

        1) Make a shell script with a "here doc"
        2) Use Expect
        3) increase the record length of your existing database ftp application

        Probably #1 is the easiest, what you do is generate your stream file so that it looks as follows: (Note: Line endings should be *LF, and not *CRLF!)
        Code:
        sftp -b - $@ <<End-of-script
        cd /br/po/outbox
        Rename order-2016-05-19-10-35-05-931.xml \
        archive/order-2016-05-19-10-35-05-931.xmlEnd-of-script
        The idea is that "-b -" will get the script from "standard input", which is supplied by the "here doc". The here doc starts with <<End-of-script and contains all of the data up until End-of-script. Everything in between those delimiters is fed to standard input. Basically, you're running a QShell script that builds a virtual file in memory. We're doing that because QShell scripts have continuation characters (where sftp batchfile does not.)

        The $@ on the sftp line means "insert all parameters passed to this script here".

        You run it from Qshell directly (not via sftp -- it takes care of starting sftp) like this (where /path/to/renameScript.sh is where you put the above script in the IFS)
        Code:
        QSH CMD('/path/to/renameScript.sh user@someserver.com')
        (You can add other sftp options before user@someserver.com if you want/need...)

        Comment


        • #5
          Hmm... the forum seemed to screw up my "here doc", and I can't see an option to go back and fix it. Let me try again using the advanced editor...

          Code:
          sftp -b - $@ <<End-of-script
          cd profound
          -rm funkyname.txt
          put authurl.txt \
          funkyname.txt
          End-of-script

          Comment


          • #6
            Thanks, I am trying to convince them to let me make a new detail sFTP table that is very long.
            Hunting down the future ms. Ex DeadManWalks. *certain restrictions apply

            Comment


            • #7
              That's frustrating. If you're going to redo it, just use stream files and then you never have to worry about the limit...

              Comment


              • #8
                Two years too late but in case anyone else comes across this problem. There is another way to rename a file using rnfr and rnto.
                In the case you have a source file that is only 80 characters, this method will allow you to have a file name of up to 69 chars.

                QUOTE rnfr <from-file-name>
                QUOTE rnto <to-file-name>

                e.g. To move a file to an archive folder:

                QUOTE rnfr a_really_long_file_name......dat
                QUOTE rnto archive/a_really_long_file_name......dat
                close
                quit


                Comment


                • #9
                  GlennGG... you are confusing FTP with SFTP.

                  Comment

                  sponsored links

                  Collapse

                  Working...
                  X