theDeSilva.com Andrew de Silva

Batch File to Copy Flex Release Build to Production Server

February 4th, 2010 · No Comments · Flex

Here’s something that I always do when writing any sort of Flex Application. I’ll write a batch file that would allow me to quickly double click it and copy all of the files on the bin-release folder to the production server. This normally save me a lot of time as I don’t have to manually look for the files and copy them to the server.

Here’s a quick way to create the batch file and edit it to do what you want to ,

  1. Open up Notepad in Windows. You can do this by navigating to Start > Programs > Accessories > Notepad, or simply by entering notepad under Start > Run.
  2. Save your file before you start writing any code
  3. Go to File > Save As.
  4. Click on the dropdown box “Save as type:” and select “All files” instead of Text (*.txt).
  5. Add .bat to the end of your file name before you save. For example copy.bat.
  6. Click on Save.

Now a little batch commands to delete the files that exist on the production server first before we copy the files from the bin-release folder to the production server followed by opening the page using the default browser.

1
2
3
4
5
6
REM Delete old production files
del \\production_server_name\production_folder\*.*
REM Copy over new production files
copy *.* \\production_server_name\production_folder\
REM Open the location of the file using default browser
start www.production_server.com

The batch file should be located in the same folder as the files that you want to copy

Share and Enjoy:
  • Digg
  • StumbleUpon
  • del.icio.us
  • Reddit
  • Technorati
  • Facebook
  • Google Bookmarks
  • LinkedIn

Tags: