Computer Hope

Microsoft => Microsoft DOS => Topic started by: jimmy1981 on June 29, 2011, 05:55:30 AM

Title: XCOPY Problem
Post by: jimmy1981 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!
Title: Re: XCOPY Problem
Post by: Sidewinder 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)
Title: Re: XCOPY Problem
Post by: jimmy1981 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'
Title: Re: XCOPY Problem
Post by: jimmy1981 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?
Title: Re: XCOPY Problem
Post by: Sidewinder 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)
Title: Re: XCOPY Problem
Post by: BC_Programmer on June 29, 2011, 03:04:20 PM
Are you running these commands in a "pure" DOS environment?
Title: Re: XCOPY Problem
Post by: jimmy1981 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!
Title: Re: XCOPY Problem
Post by: jimmy1981 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,
Title: Re: XCOPY Problem
Post by: Sidewinder 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 (http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=17657) if it runs on your system.

 8)
Title: Re: XCOPY Problem
Post by: jimmy1981 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?
Title: Re: XCOPY Problem
Post by: Sidewinder 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)
Title: Re: XCOPY Problem
Post by: jimmy1981 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.


Title: Re: XCOPY Problem
Post by: BC_Programmer 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?