5 Replies Latest reply on Aug 15, 2018 11:05 AM by Eric Allen

    Execute Command Help

    Prasad Bhonsule

      Hi all, I'm trying to run robocopy on a transition action in PDM Pro.

       

      I want to copy a file that is going through the transition to a folder outside the vault.

       

      I've read on the forums here and other forums, about enclosing the path, and the parameters in double quotes etc, but not having much luck so far. Here is a pic of what I'm trying to accomplish, any help is greatly appreciated

       

      Execute command syntax.png

       

      Kind regards

       

      Prasad Bhonsule

        • Re: Execute Command Help
          Ulf Stockburger

          Hi Prasad Bhonsule

           

          Run this to see what happens.

          cmd.exe /K "C:\Windows\System32\robocopy.exe %FilePath% D:\PDFs\ %FileName%"

           

          If xcopy is an option, try using this.

          cmd.exe /C "C:\Windows\System32\xcopy.exe /Y %FilePath% D:\PDFs\%FileName%*"

           

          I hope it helps.

           

          BiI SAP-PDM

          • Re: Execute Command Help
            Scott Stuart

            You might also try putting the filepath and destination path in quotes, since it's possible your filepath contains spaces.

            • Re: Execute Command Help
              Charley Saint

              Don't use robocopy for single files, it's meant for directories. The syntax for robocopy is

               

              robocopy sourcedir destdir filename so you'd need something like this

               

               

              But that doesn't work since Folderpath is something like \Test\ instead of C:\Vault\Test. You can validate in ProcessMonitor:

               

               

              So if you change the command to xcopy "sourcefilepath" "destfilepath" /Y then it should work great. (Don't put the filename in the dest or it will prompt you to verify if the name is a file or directory, /Y overwrites without prompt)

               

              • Re: Execute Command Help
                Prasad Bhonsule

                Thanks everyone, finally got it working with Charley's suggestions as above.

                 

                Thanks again!

                 

                Prasad

                • Re: Execute Command Help
                  Eric Allen

                  I had a similar need and the correct answer was very helpful however the PDM user that will initiate this transition doesn't have access to the file share outside of the PDM vault where I wanted the file copied. I used the below 3 "Execute command" steps in my transition to pull this off. The only downside I've found is that 3 CMD windows pop up for less than a second.

                   

                  image.png

                  Map Z:

                  net use Z: "\\XX.XX.XX.XXX\QMS Docs\" /user:PDMUSER@MYDOMAIN PDMUSERPASSWORD /persistent:no

                  (PDMUSER is a special user that has write access only to this "QMS Documentation" folder and the password is set to not expire in AD)

                   

                  Copy File:

                  "C:\Windows\System32\xcopy.exe" "%FilePath%" "Z:" /y /q

                   

                  Delete Z:

                  net use Z: /delete /y

                   

                  It's important to have "Wait until the started program terminates." checked for all three transitions.

                   

                  I hope this helps someone else in the future.