Filecopy action

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • jammer2
    Forum Member
    • Apr 2005
    • 20

    Filecopy action

    I can't get filecopy to copy my file to a destination directory, here's the action
    File.Copy("AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\Program Files\BPFTP", true, true, false, true, nil);
  • Intrigued
    Indigo Rose Customer
    • Dec 2003
    • 6138

    #2
    Originally posted by jammer2
    I can't get filecopy to copy my file to a destination directory, here's the action
    File.Copy("AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\Program Files\BPFTP", true, true, false, true, nil);
    Right off I see you started out with proper path syntax "\\". But, as you can see in the second argument... you missed a couple "\"

    Try:

    File.Copy("AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\\Program Files\\BPFTP", true, true, false, true, nil);
    Intrigued

    Comment

    • TJ_Tigger
      Indigo Rose Customer
      • Sep 2002
      • 3159

      #3
      You will also want to ensure that the destination directory exists.

      Tigg
      TJ-Tigger
      "A common mistake that people make when trying to design something completely foolproof was to underestimate the ingenuity of complete fools."
      "Draco dormiens nunquam titillandus."
      Map of IR Forum Users - IR Project CodeViewer - Online Help - TiggTV - QuizEngine

      Comment

      • jammer2
        Forum Member
        • Apr 2005
        • 20

        #4
        Originally posted by TJ_Tigger
        You will also want to ensure that the destination directory exists.

        Tigg
        It does exist

        Comment

        • Eagle
          Indigo Rose Customer
          • Mar 2005
          • 944

          #5
          Code:
          File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);

          Comment

          • Intrigued
            Indigo Rose Customer
            • Dec 2003
            • 6138

            #6
            Originally posted by Eagle
            Code:
            File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);
            In this situation.. the _SourceFolder built-in is not necessary. But, it definitely is good programming practice!

            :yes
            Intrigued

            Comment

            • jammer2
              Forum Member
              • Apr 2005
              • 20

              #7
              Sorry guys this does'nt copy bpft.reg to C:\Program Files\BPFTP

              File.Copy("AutoPlay\\Docs\\BPFTP.REG", "C:\\DestDir\\program\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);

              Comment

              • Eagle
                Indigo Rose Customer
                • Mar 2005
                • 944

                #8
                as it is..it can't Jammer..

                the 'destination path' needs to be correct..you have other 'path folders'
                in your action...we just gave you correct 'syntax for your supplied path.

                lets know if still stuck..

                try this:

                Code:
                File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);
                you need to have the exact folder path and as Tigger sugggested..
                all folders in the path Must be correct and exist Before any file copy actions.
                Last edited by Eagle; 04-17-2005, 02:22 AM.

                Comment

                • jammer2
                  Forum Member
                  • Apr 2005
                  • 20

                  #9
                  Originally posted by Eagle
                  as it is..it can't Jammer..

                  the 'destination path' needs to be correct..you have other 'path folders'
                  in your action...we just gave you correct 'syntax for your supplied path.

                  lets know if still stuck..

                  try this:

                  Code:
                  File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);
                  you need to have the exact folder path and as Tigger sugggested..
                  all folders in the path Must be correct and exist Before any file copy actions.
                  Ok, that worked Eagle, Thanks for the help

                  Comment

                  • jammer2
                    Forum Member
                    • Apr 2005
                    • 20

                    #10
                    Originally posted by Eagle
                    as it is..it can't Jammer..

                    the 'destination path' needs to be correct..you have other 'path folders'
                    in your action...we just gave you correct 'syntax for your supplied path.

                    lets know if still stuck..

                    try this:

                    Code:
                    File.Copy(_SourceFolder.."\\AutoPlay\\Docs\\BPFTP.REG", "C:\\Program Files\\BPFTP\\BPFTP.REG", true, true, false, true, nil);
                    you need to have the exact folder path and as Tigger sugggested..
                    all folders in the path Must be correct and exist Before any file copy actions.
                    I wish I knew or understood what the double back slashes in the destination path does and where thats listed somewhere. On my own I would never had even tried that.

                    Comment

                    • Stefan_M
                      Indigo Rose Customer
                      • Nov 2003
                      • 315

                      #11
                      if you want to copy files into the program files folder use
                      _ProgramFilesFolder .. "\\BPFTP\\BPFTP.REG"
                      instead of
                      "C:\\Program Files\\BPFTP\\BPFTP.REG"

                      Its more flexible to use "Global variables" rather then absolute paths.

                      See Onlinehelp:
                      "Program Reference - Variables" Overview,Global Variables
                      "Scripting Guide - Variables - Types and Values" String



                      Stefan_M
                      "With a rubber duck, one's never alone."

                      Douglas Adams, The Hitchhiker's Guide to the Galaxy

                      Comment

                      • jammer2
                        Forum Member
                        • Apr 2005
                        • 20

                        #12
                        Ok thanks for the info Stefan_M
                        I appreciate it.

                        Comment

                        Working...
                        X