1

I have 3 folders on Windows system:

  • S - Source code folder.

  • A - Application server folder.

  • B - Backup folder.

I am able to copy all modified/new files from S to A by using Ant copy command.

My requirement is before copying/overwriting files S to A, I have to take backup of all files from A to B.

I.e. I want to copy those files from A to B which will get updated from S to A

In simple terms taking backup of production system folder before uploading new code.


Copying from A to B is not the problem, the problem is to get the list of files by comparing S & A and then copy them from A to B Suppose I have 3 files in on S & A which are in sync One.txt, Two.txt, Three.txt. Now the developer only changed Three.txt So I will have to copy Three.txt from S to A, but before overriding file on A, I want to take the back of Three.txt by copying it from A to B.

kenorb
  • 155,785
  • 88
  • 678
  • 743
Hasan Khan
  • 11
  • 2
  • What exactly is the problem? You were able to use Ant to copy files from S to A; what happened when you tried doing the same thing for A to B? – CAustin Aug 23 '17 at 22:16
  • Thanks, Copying from A to B is not the problem, problem is to get the list of files by comparing S & A and then copy them from A to B Suppose I have 3 files in on S & A which are in sync One.txt Two.txt Three.txt Now the developer only changed Three.txt So I will have to copy Three.txt from S to A, but before overriding file on A, I want to take the back of Three.txt by copying it from A to B – Hasan Khan Aug 24 '17 at 05:22
  • It sounds like Ant's `intersect` resource collection might be what you're looking for: https://ant.apache.org/manual/Types/resources.html#intersect – CAustin Aug 24 '17 at 18:17
  • After spending good time i have create the build file, but i am unable to post here in comment box and also i am not able to find link to answer my own question – Hasan Khan Sep 01 '17 at 07:21

0 Answers0