Important Notice: On February 29th, this community was put into read-only mode. All existing posts will remain but customers are unable to add new posts or comment on existing. Please feel to join our Community Discord for any questions and discussions.

Saving a temporary copy of a file before deploy and then restoring it after.

Hello all!

I'm using PDQ Deploy to install an application that I wrote.  I use the AppConfig file to store data specific to the computer the app is installed on.  Every time I install a new version, I uninstall the prior version and install the new version.  This ends up deleting the AppConfig and I have to re-edit every computer.  Is there a way to have PDQ copy that file to a temp location and then restore it after the uninstall/install is complete?  Or "protect" that file somehow during the uninstall process?

TIA!!

Jim

 

1

Comments

4 comments
Date Votes
  • Jim,

    Maybe I'm missing something, but couldn't you just do a file copy step before the install step that renames/moves the file, then another file copy step after the install step that renames/moves it back?

    1
  • That's what I was going to do but it looks like that only copies files from the server to the destination computer.  I just want to copy it from one folder to another on the destination computer.  Or, are you suggesting copying it up to the server and then back down again?  I guess that could work.

    1
  • Jim,

    You could copy it up to the server and back down but that seems unnecessary. I didn't consider that the file copy step assumes you're copying from the server, in that case I would just use a command step instead. Something like this for the before step, with the two variables in the move command swapped for the after step:

     

    1
  • This is what I use for our shipping software. Our machines have different configs for printers, but the file is the same. I copy the config file off and rename it to the computer name, and then can easily copy it back by calling it with the computer name variable. 

    In your case, run this as step 1:

    ECHO F | xcopy /y "C:\Program Files\AppConfig\file.txt" \\SERVER\SHARE$\%computername%.txt

    Run this at the end:

    ECHO F | xcopy /y \\SERVER\SHARE$\%computername%.txt "C:\Program Files\AppConfig\file.txt"

    1