PxPlus User Forum

Twitter Twitter Twitter

Author Topic: XCOPY  (Read 248 times)

Jeffrey Ferreira

  • Gold Member
  • ****
  • Posts: 78
    • View Profile
XCOPY
« on: July 02, 2020, 11:45:43 AM »
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

michaelgreer

  • Silver Member
  • ***
  • Posts: 43
    • View Profile
Re: XCOPY
« Reply #1 on: July 02, 2020, 12:53:28 PM »
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

  • Gold Member
  • ****
  • Posts: 78
    • View Profile
Re: XCOPY
« Reply #2 on: July 02, 2020, 12:56:12 PM »
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

  • New Member
  • *
  • Posts: 3
    • View Profile
Re: XCOPY
« Reply #3 on: July 02, 2020, 01:12:50 PM »
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

  • Gold Member
  • ****
  • Posts: 78
    • View Profile
Re: XCOPY
« Reply #4 on: July 02, 2020, 01:17:15 PM »
i did try robocopy but not those switches..
i'll give it a try..
thanks

Mike King

  • Administrator
  • Diamond Member
  • *****
  • Posts: 3353
  • Mike King
    • View Profile
    • PVX Plus Technologies
Re: XCOPY
« Reply #5 on: July 02, 2020, 04:19:34 PM »
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


Jeffrey Ferreira

  • Gold Member
  • ****
  • Posts: 78
    • View Profile
Re: XCOPY
« Reply #6 on: July 02, 2020, 04:26:53 PM »
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