Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XCOPY/XCOPY32 Equivalent?

Status
Not open for further replies.

rianeiromiron

Programmer
Jul 1, 2001
151
GT
Many of you know the super functionality of xcopy32.exe included in D.O.S., for instance, the parameter /s or the /D parameters are simple amazing.
I have an application in VFP 6 which makes automatic backups twice a day or in pre-programmed schedules.
Because of it's functionality I use xcopy32 to copy files from the source to the backup drive. I certainly know I can use VFP functions to scan directories, get the file info and so on but by doing so I would need to scan files one by one and then copy them if appropiate. There's nothing wrong with using xcopy32 with a RUN command, but, the gracious DOS windows that pops when you execute RUN.... So, the question comes to this:

What can I do to obtain the equivalent for /D using WINDOWS-only commands?


Thanks a lot.

Rianeiro Mirón
 
rianeiro

On way would be to simply run your existing code hidden through a WinAPI call.

lcProg2Run = [xcopy C:\MyApp\*.* D:\Backup\*.*] && Your xcopy commandline
DECLARE INTEGER WinExec IN kernel32 ;
[tab]STRING lpCmdLine ,;
[tab]INTEGER uCmdShow
IF !WinExec(lcProg2Run,0) > 31
[tab]* MESSAGEBOX()
ENDIF

*0 = Hide
*1 = Normal
*3 = Maximized
*6 = Minimized

Chris :)
 
Thanks a lot Chris. It worked just fine. Do you know how to run "internal" DOS commands like DIR, or TIME, because using the same method I was unable to use them.

Rianeiro
 
rianero

No, I don't and I believe you would be better off using CURDIR(), ADIR(), SECONDS() etc rather the DOS equivalents

Chris :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top