SysCommand

 12 Replies
 1 Subscribed to this topic
 52 Subscribed to this forum
Sort:
Author
Messages
charliewilliam
Basic Member
Posts: 16
Basic Member

    Hi,

    I am trying to copy a file using the SysCommand node and running into some trouble.  Hoping someone can assist.

    Here is what I have but I am getting an error:  The system cannot find the file specified.  This is the very path I am using to create the file - works just fine.  At the end of the flow, I want to copy the file to an Archive folder and now it is saying it cannot find the file.  BUT, it is there!

    SysCommand - Command:

    Copy \prod\work\Vendor_Files\OutFile.csv \prod\work\Vendor_Files\Archive\OutFile.csv

    (nothing in the Command Input box)

     

    Thanks

    Woozy
    Veteran Member
    Posts: 709
    Veteran Member
      Hi cwilliam - I'm not sure if this is the issue, but shouldn't the destination be a folder rather than a file?

      Copy \prod\work\Vendor_Files\OutFile.csv \prod\work\Vendor_Files\Archive
      or
      Copy \prod\work\Vendor_Files\OutFile.csv Archive

      Good Luck!
      Kelly
      Kelly Meade
      J. R. Simplot Company
      Boise, ID
      charliewilliam
      Basic Member
      Posts: 16
      Basic Member

        Kelly,

        Thank you for your reply!  Immediately I thought I was such an idiot for not seeing this earlier.  But I tried changing the Command to each of the following but still get "The system cannot file the file specified".

        Copy \prod\work\Vendor_Files\OutFile.csv \prod\work\Vendor_Files\Archive

         

        Copy \prod\work\Vendor_Files\OutFile.csv \prod\work\Vendor_Files\Archive\

         

        Copy \prod\work\Vendor_Files\OutFile.csv Archive

         

         

        Woozy
        Veteran Member
        Posts: 709
        Veteran Member
          Hmmm - will you please attach your log (or the relevant portion), and maybe a screenshot of your syscmd node properties?

          What happens if you use the syscmd to send "dir" maybe "cd"?
          Kelly Meade
          J. R. Simplot Company
          Boise, ID
          charliewilliam
          Basic Member
          Posts: 16
          Basic Member
            I attached a print screen.  THANKS!
            Attachments
            Woozy
            Veteran Member
            Posts: 709
            Veteran Member
              This isn't really my area of expertise, but it looks like maybe the syscmd node doesn't like what you're asking it to do. Have you been successful doing this in the past? What happens if you open a command prompt and paste in the full system command (line 3) and run it. Does it work? Does this work in the DEV server? If so, is there a chance that server rights are different on PROD and the user/password where this is trying to run don't work on PROD?

              I also know that sometimes the syscmd node doesn't play well. You may be better off to create a script on the server to do the copy and just call the script.

              Sorry I can't help much more than that. Maybe someone else can see the issue?
              Kelly Meade
              J. R. Simplot Company
              Boise, ID
              Woozy
              Veteran Member
              Posts: 709
              Veteran Member
                Wait a sec - something just occurred to me.

                Are you perhaps testing this on a Windows machine (using IPDesigner) but your server is UNIX? If so, that's why this node is failing. Windows and Unix use different system calls, but IPA pulls the information from the server. It's doing a system call for Unix, but trying to perform it on your Windows box - and Windows doesn't know what "su" means.
                Kelly Meade
                J. R. Simplot Company
                Boise, ID
                charliewilliam
                Basic Member
                Posts: 16
                Basic Member
                  Kelly,

                  I was told this is a Windows server - not UNIX. There are other flows with the syscommand calling .bat files where the copy is done in the .bat file. I suspect we will have to change all this when we move from on premise to the cloud. This is why I was trying to use the syscommand alone, without .bat files.
                  Woozy
                  Veteran Member
                  Posts: 709
                  Veteran Member
                    Hmmm. I just realized that you are using PFI rather than IPA, right? I guess that throws out my earlier comment anyway. Sorry.

                    One other thought - rather than building the full command string within the node, try building the source path/filename and destination path in variables first, then referencing them in your copy command. Maybe the slashes are causing confusion?
                    Kelly Meade
                    J. R. Simplot Company
                    Boise, ID
                    charliewilliam
                    Basic Member
                    Posts: 16
                    Basic Member
                      I figured it out! At the top of the SysCommnad Properties there is the "Execution Mode". It was set to "automatic". After what you said Kelly, I figured I would change it to "run cmd.exe (Windows only)" to force it to function in a Windows environment. It worked! Seems "automatic" isn't so automatic afterall.

                      Thank you for your help!
                      Woozy
                      Veteran Member
                      Posts: 709
                      Veteran Member
                        Excellent! I'm glad you figured it out.
                        Kelly Meade
                        J. R. Simplot Company
                        Boise, ID
                        Randy
                        Veteran Member
                        Posts: 50
                        Veteran Member

                          I can't remember exactly, but went thru same issue. I think I found the destination had to have filename as well. However, this was my final solution. Also make sure what ever configuration your system command is running on , has the SYS CMD using an owner with rights to all the paths. We usually set this as "Lawson" user with full rights.

                          In Windows Environment, I've setup a "MOVE.CMD" file and call it with the system node with fully qualified path/filename using global Variables.

                          Global Variable Source File (%1) = = \\\\Host\\Share\\RevImportFileName.csv

                          Global Variable Destination File (%2)  = = \\\\Host\\Share\\ARCHIVE\\RevImportFileName.csv

                          Global Variable Path/Name of ArcIt batch command = = \\\\Host\\Share\\AcrIt.CMD

                          ( Double (escape) back-slashes in file path)

                          ArcIt.cmd = MOVE %1 %2

                          Sys Command =       

                           

                           

                           

                           

                           

                           

                           

                          charliewilliam
                          Basic Member
                          Posts: 16
                          Basic Member
                            Thank you Randy for the input. Great idea to use Global Variables! I will have to look at that when we convert the flows from PFI to IPA for sure!