2

First I understand I should probably be using GitHub or some other online repository, but I would like to explore some of the concepts necessary for my method to work.

I would like to run a batch script/program every time I close Visual Studio, Eclipse, Notepad. Specifically, I would like to run a copy program to copy all of my source code that I generated with that program to a folder inside a Google Drive/Dropbox folder. That way I know it is saved to the cloud. this way I do not have to set up a special backup extension inside each Development enviornment.

Firstly is there a built in simple solution for doing the above? or Do I need to write a custom service that checks to see when those programs are closed? and if that is the way to go where should I look for an example of how to get started?

Thanks.

jth41
  • 3,808
  • 9
  • 59
  • 109
  • I would recommend something like this: http://stackoverflow.com/q/1960799/94928 instead of manually copying files. – heavyd Aug 31 '12 at 19:15

3 Answers3

2

I think instead of going for this approach, you can run your script on a timely basis - say every 15 min.

This appraise will have below advantages advantages:

  1. Easy to implement
  2. Tool Independent
  3. Timely Backup
  4. Re-Use

So I think your problem will be solved by this approach.

Atul
  • 1,694
  • 4
  • 21
  • 30
2

No, there is no simple built-in method that will backup the files that you want when you want it.

Instead you could simply point your work directories to your Gdrive or DropBox folders, and create a folder inside them for each.

Or you could create a task that copies the files every 10 minutes or however long.


But if you want it to run only when you exit the programs you specify: Yeah, you'll pretty much need to write a batch file for each of the programs you want to back up. Then call the batch file instead of the program.

startVS.bat

set DropBox=C:\Wherever\
start /wait "" "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe"
xcopy /s /e /d /y "%userprofile%\Documents\Visual Studio 2008\Projects\*.*" "%DropBox%"

If you want to have the same icon, and for the batch file run minimized:

1) Open Windows Explorer, navigate to startVS.bat, right-click on it, and click Create Shortcut.
2) Right-click on startVS - ShortCut -> Click Rename and rename it Visual Studios, then press [ENTER].
3) Right-Click on the new Visual Studios -> Properties -> Change Icon -> Browse
4) Paste %ProgramFiles% (x86)\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe into the File Name box.
5) Click Open -> OK
6) Click Normal Window -> Minimized -> OK
7) Put a copy of Visual Studios (really named Visual Studios.lnk) where ever you want it, like in the Start menu.

If you are not running a 64 bit system, at step 4 paste %ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\devenv.exe into the File Name box.

James K
  • 4,005
  • 4
  • 20
  • 28
0

For Google Drive, I've been messing around with GoogleCL: (I'm on Linux/Crunchbang)

$ sudo apt-get install python-gdata
$ sudo apt-get install googleCL

This'll give you the 'google' command:

$ which google
$ man google

You can upload files:

$ google docs upload foo.txt

(seems to store it as 'foo')

And download it: (in my opinion, syntax is inconsistent)

$ google docs get --title foo

(it won't find foo.txt for some reason)

So far, I'm not that happy with it. I want to encrypt files and park them there, but it seems to choke on them. I've tried uuencoding them so I can just upload a text file, but have had inconsistent results on files that aren't all that big (1.6 Mbytes). Maybe Google doesn't want to deal with files it can't get any search results out of ? Anyway, maybe Dropbox is better; haven't tried it yet.

AAAfarmclub
  • 2,202
  • 1
  • 19
  • 13