6
4
I'm working on a massive Java web application which is kept under centralized version control, but the source files are used to build and run the actual server, which then copies all the files I work on into a random temporary directory while it's running.
My problem is that I need to either rebuild this huge application to see any changes to my files, or keep track of all my changes and copy over the files I've changed back to their source location before committing them back to source control.
My question is: is there a command line script I can run that will monitor any changes in the source folder and automatically copy changed files across to temporary folder X?
The idea is to remove the human point of failure in having to manually mitigate the two-locations problem.
Do you want a folder that it a perfect copy or a folder that consists only of changed files? – David – 2013-02-25T15:15:48.790
Perfect copy. When I build the application, it makes one big copy. I'd like my manual changes to the source to be automatically migrated to the copy folder. – Barney – 2013-02-25T15:17:59.703
Robocopy can do it but I am not sure if that's a good idea. – kush – 2013-02-25T15:18:36.317
Thanks @kush, wasn't aware of robocopy. Not sure it's a good idea… Because robocopy is flaky? Implementation is dangerous? Inherently bad idea?
– Barney – 2013-02-25T15:20:48.813You should not have to come up with your own implementation to something that sounds like (please correct me if I am wrong) a pretty common scenario. You are taking files on the production server and updating your temp folder (and not the other way), right? – kush – 2013-02-25T15:27:16.430
Keeping two copies of the exact same file is a bit like using the goto statement in programming, sometimes it's necessary, but most of the time, there is a better way. – David – 2013-02-25T15:28:55.747
Actually, both locations are on my local filesystem. Ironically I know of plenty of tools which will persist any changes on my system to a remote location via SFTP, but nothing that'll do it from one 'source' location on disk to another arbitrary 'cache' location, also on my local disk. Turns out robocopy can't copy open files.
– Barney – 2013-02-25T15:29:41.470@Jikag I agree, I shouldn't be fighting this huge semi-automated application to sanitize my workflow. The problem is I'm one of the few people working on files that need a rapid trial-and-error workflow, while most of the work on the application needs conditional compilation based on local system etc. – Barney – 2013-02-25T15:53:38.980
Would a Continuous Integration solution such as Hudson or Jenkins help you perhaps?
– Karan – 2013-02-25T22:51:55.467