Home > Archive > Programming with dBASE > November 2005 > Move function not working









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Move function not working
Marc McPharlin

2005-11-29, 3:23 am

Hello,

I am trying to run a program that was developed for Win98 on a WinXp
machine. All the code seems to be working except for one line.

!MOVE "W:\CP1\CPDATA\"+TRIM(NAME)+".P2J" W:\P2JSAVE\

I'm not sure why it won't work. Is there something with XP that the move
function needs? A switch maybe?

Thanks for any help

Marc


Bruce Beacham

2005-11-29, 7:23 am

Marc McPharlin wrote:

> I am trying to run a program that was developed for Win98 on a WinXp
> machine. All the code seems to be working except for one line.
>
> !MOVE "W:\CP1\CPDATA\"+TRIM(NAME)+".P2J" W:\P2JSAVE\
>
> I'm not sure why it won't work. Is there something with XP that the move
> function needs? A switch maybe?


Don't shell out to DOS for that. Use dBASE's excellent rename command
instead. See the OLH.


Bruce Beacham
Mervyn Bick

2005-11-29, 9:24 am

On Tue, 29 Nov 2005 00:32:25 +0200, Marc McPharlin <itmgr@classiccabs.com>
wrote:

> Hello,
>
> I am trying to run a program that was developed for Win98 on a WinXp
> machine. All the code seems to be working except for one line.
>
> !MOVE "W:\CP1\CPDATA\"+TRIM(NAME)+".P2J" W:\P2JSAVE\
>
> I'm not sure why it won't work. Is there something with XP that the move
> function needs? A switch maybe?


The only switches available for the DOS MOVE command under XP are /y and
/-y (and, of course, /?). Click on Help & Support on the Start menu and
enter dos move in the search window. The "Command-line reference A-Z"
option will take you to the appropriate page.


Using the DOS MOVE command worked for me with the filename hard coded
between the inverted commas but it didn't work when I built up the name as
you did.

Try the following instead.

command = "!MOVE W:\CP1\CPDATA\"+TRIM(NAME)+".P2J W:\P2JSAVE\"
&command

There is usually more than one way to do things in dBase and if it works
it can't be wrong! <g> My own preference is not to use "2-in-1" commands
like MOVE but to rather COPY and then DELETE after checking that the COPY
actually took place which gives the opportunity to handle any failure in
an elegant manner. If the DOS command screws up, for whatever reason,
your user is on his own. By and large, I prefer to use the built-in dBase
commands rather than to RUN the DOS commands but they're available so it
can't be wrong to use them. <g>

Mervyn.
Sponsored Links





Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive | Programming forum archive

Copyright 2008 droptable.com