XCOPY

Started by Jeffrey Ferreira, July 02, 2020, 11:45:43 AM

Previous topic - Next topic

Jeffrey Ferreira

Hi List,
i'm trying to backup some data off hours. From what i read about XCOPY on Windows is that it should not lock the file. but i tend to get error 0's in pxplus if someone tries to access the file.  There are very few users on system when i run this but i was just curious
does anyone know a command line way to backup files without causing error 0 in pxplus applications.
thanks
jeff

Michael Greer

Jeff,

I don't know if this will help, but just because xcopy doesn't lock a file doesn't mean it can copy a locked file. So, this works:

0005 cmd$=env("COMSPEC")+" /C xcopy jmg.txt back"
0007 open (hfn)"jmg.txt"
0010 y=sys(cmd$)
0015 print y

But this doesn't:

0005 cmd$=env("COMSPEC")+" /C xcopy jmg.txt back"
0007 open lock (hfn)"jmg.txt"
0010 y=sys(cmd$)
0015 print y

Michael

Jeffrey Ferreira

For me this is what is failing
kickoff copy...while it is running...try to open file

0005 cmd$=env("COMSPEC")+" /C xcopy jmg.txt back"
0010 y=sys(cmd$)
0020 open (hfn)"jmg.txt"

line 20 gets an error 0


Jim Morton

Have you tried robocopy? It has a wealth of switches that will likely do what you want. Check /z or /b or /zb. More info on available switches can be found here https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/robocopy

Jeffrey Ferreira

i did try robocopy but not those switches..
i'll give it a try..
thanks

Mike King

Have you consider the PxPlus "CREATE FILE" command?  It will allow you to copy opened files.

Have at look at: https://manual.pvxplus.com/?/directives/create_file.htm

Mike King
President - BBSysco Consulting - http://www.bbsysco.com
eMail: mike.king@bbsysco.com

Jeffrey Ferreira

No i haven't i will look at it...the robocopy flags looked promising but it did not work...i will look at create file....i'm just trying to do a cheap quick backup for client (not as their primary solution)...but a quick way we can go back a few days and view system as it was a few days ago.....i will try "create file" thanks