Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: XCOPY Problem  (Read 5740 times)

0 Members and 1 Guest are viewing this topic.

jimmy1981

    Topic Starter


    Greenhorn

    • Experience: Beginner
    • OS: Unknown
    XCOPY Problem
    « on: June 29, 2011, 05:55:30 AM »
    Hi all,

    I'm writing a batch that is run through FoxPro.

    it basically copies a file from C and then places that copy on a network folder.

    Code: [Select]
    XCOPY "C:\TEST\TEST1\TEST2.DBF"  "\\server\shared\test\test1\testSplit\LiveData\%1A.dbf"
    the %1 is the date that is pulled from foxpro.

    At the minute i keep getting a prompt for File name or Directory Name, it's a file so i press F and it works perfectly. How do i stop it
    prompting for the F?

    also, why does COPY not work in this situation?

    thanks in advance, i'm out of ideas!

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: XCOPY Problem
    « Reply #1 on: June 29, 2011, 07:19:29 AM »
    You might try piping the F response into the XCOPY command:

    Code: [Select]
    echo F | XCOPY "C:\TEST\TEST1\TEST2.DBF"  "\\server\shared\test\test1\testSplit\LiveData\%1A.dbf"

    Quote
    also, why does COPY not work in this situation?

    How does it not work? Error messages? Usually it's easier to get COPY to work than XCOPY.

     8)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein

    jimmy1981

      Topic Starter


      Greenhorn

      • Experience: Beginner
      • OS: Unknown
      Re: XCOPY Problem
      « Reply #2 on: June 29, 2011, 08:21:13 AM »
      Tried:

      Code: [Select]
      echo F | XCOPY "C:\TEST\TEST1\TEST2.DBF"  "\\server\shared\test\test1\testSplit\LiveData\%1A.dbf"
      and i get 'Program too big to fit in memory'

      The COPY error i get using

      Code: [Select]
      COPY "C:\TEST\TEST1\TEST2.DBF"  "\\server\shared\test and test\testSplit\LiveData\%1A.dbf"

      is 'too many parameters'

      jimmy1981

        Topic Starter


        Greenhorn

        • Experience: Beginner
        • OS: Unknown
        Re: XCOPY Problem
        « Reply #3 on: June 29, 2011, 08:29:03 AM »
        ok new development.

        the actual copy to location I am using is

        Code: [Select]
        echo F | XCOPY "C:\TEST\TEST1\TEST2.DBF"  "\\SERVER\TEST\Data and Analysis\UplSplit\LiveData\%1c.dbf"
        which is where i get the 'Program too big to fit in memory'


        but changing that to below works and the piping the F has done the job too:

        Code: [Select]
        echo F | XCOPY "C:\TEST\TEST1\TEST2.DBF"  "\\SERVER\TEST\IT Group\TEST1\UpSplit\LiveData\%1b.dbf"
        So this seems to point at a problem with the length of the location name?

        Sidewinder



          Guru

          Thanked: 139
        • Experience: Familiar
        • OS: Windows 10
        Re: XCOPY Problem
        « Reply #4 on: June 29, 2011, 08:59:47 AM »
        Quote
        So this seems to point at a problem with the length of the location name?

        Doubtful. What format is the date from FoxPro (%1)? The interpreter seems to be choking and this is the only variable in the command.

        Post the date format, we may be able to show you how to fix it.

         8)
        The true sign of intelligence is not knowledge but imagination.

        -- Albert Einstein

        BC_Programmer


          Mastermind
        • Typing is no substitute for thinking.
        • Thanked: 1140
          • Yes
          • Yes
          • BC-Programming.com
        • Certifications: List
        • Computer: Specs
        • Experience: Beginner
        • OS: Windows 11
        Re: XCOPY Problem
        « Reply #5 on: June 29, 2011, 03:04:20 PM »
        Are you running these commands in a "pure" DOS environment?
        I was trying to dereference Null Pointers before it was cool.

        jimmy1981

          Topic Starter


          Greenhorn

          • Experience: Beginner
          • OS: Unknown
          Re: XCOPY Problem
          « Reply #6 on: June 30, 2011, 01:11:03 AM »
          The date is sent from FoxPro and within FoxPro the date format is YYMMDD. I then just add a letter after the date.

          If it's not the UNC length then why does it work with another UNC (a shorter one) but not this one? Surely it cant be a problem with the %1 being passed from foxpro as it works with a different UNC?


          forgive my ignorance, but what is 'pure' DOS? I'm a newbie when it comes to all of this!

          jimmy1981

            Topic Starter


            Greenhorn

            • Experience: Beginner
            • OS: Unknown
            Re: XCOPY Problem
            « Reply #7 on: June 30, 2011, 01:25:16 AM »
            ok to back up your theory, i ran the batch on its own outside of foxpro and it works fine, obviously the filename is just a letter as no date is passed. so i end up with a filename called A.dbf.

            I then try and run it from foxpro and i get the 'Program is too big to fit in memory' message.

            I just cant get my head round why it works with a different UNC.


            Also, if i map to the drive so have:
            Code: [Select]
            echo F | XCOPY "C:\TEST\TEST1\TEST2.DBF"  "H\UplSplit\LiveData\%1c.dbf"
            this works perfectly,
            « Last Edit: June 30, 2011, 02:11:03 AM by jimmy1981 »

            Sidewinder



              Guru

              Thanked: 139
            • Experience: Familiar
            • OS: Windows 10
            Re: XCOPY Problem
            « Reply #8 on: June 30, 2011, 06:19:10 AM »
            Depending what OS you're using, the length of each the source and destination path may indeed be a factor. If it works by mapping the drive, then the problem is solved.

            You might try RoboCopy if it runs on your system.

             8)
            The true sign of intelligence is not knowledge but imagination.

            -- Albert Einstein

            jimmy1981

              Topic Starter


              Greenhorn

              • Experience: Beginner
              • OS: Unknown
              Re: XCOPY Problem
              « Reply #9 on: June 30, 2011, 07:24:17 AM »
              turns out it was the length of the path so i've copied to another location with a shorter name and it works fine now.

              It wouldnt work with COPY said it couldnt find the path, but it works ok with XCOPY  ???

              however, i'm now struggling with the fact it wont DEL the file. DEL says cant find the path too even though it's just successfully copied the file there.

              Any ideas?

              Sidewinder



                Guru

                Thanked: 139
              • Experience: Familiar
              • OS: Windows 10
              Re: XCOPY Problem
              « Reply #10 on: July 01, 2011, 04:35:29 AM »
              Quote
              I'm writing a batch that is run through FoxPro.

              I just noticed this line from the first post. I'm not familiar with FoxPro, so how exactly does this batch file run?

              On modern systems, file names can be up to 255 characters so that wouldn't seem to be a problem.

              Quote
              however, i'm now struggling with the fact it wont DEL the file. DEL says cant find the path too even though it's just successfully copied the file there.

              What happens if you use the shorter file name (mapped drive)?

              Why not post your batch file, mention what OS you're using and explain how the batch file gets executed. There is a bigger picture here that doesn't make a lot of sense.

               8)
              The true sign of intelligence is not knowledge but imagination.

              -- Albert Einstein

              jimmy1981

                Topic Starter


                Greenhorn

                • Experience: Beginner
                • OS: Unknown
                Re: XCOPY Problem
                « Reply #11 on: July 01, 2011, 04:55:52 AM »
                thanks for the help, now its copying to a shorter UNC it works fine, foxpro obviously cant cope with long UNC's.

                with regards to the DEL i ended up having to map to the drive anyway as foxpro cant 'set defualt' to a UNC, didnt really want to map as wanted to hide the contents from the user to avoid possible deletes/modifications, but alas they'll just have to accept some ownership.

                cheers all.



                BC_Programmer


                  Mastermind
                • Typing is no substitute for thinking.
                • Thanked: 1140
                  • Yes
                  • Yes
                  • BC-Programming.com
                • Certifications: List
                • Computer: Specs
                • Experience: Beginner
                • OS: Windows 11
                Re: XCOPY Problem
                « Reply #12 on: July 01, 2011, 05:42:38 AM »
                thanks for the help, now its copying to a shorter UNC it works fine, foxpro obviously cant cope with long UNC's.
                Which version of FoxPro are you using?
                I was trying to dereference Null Pointers before it was cool.