Creating a Project Folder with a Batch File
Whenever I start a Website Project I have the following basic folder structure:
-root
'- assets
' '- css
' '- js
root is the project folder and contains sites like index.php
, header.php
, footer.php
and so on. The assets folder contains all assets hosted within the pages sub folder or domain root (some of my images for example are hosted on sub domains so they can load faster) and within the assets folder I have css and js files - and SCSS files (I organize them all inside the css folder).
Well, what I came up with now is: Why shouldn't I write a Batch file to create exactly this structure? And I made one.
set /p project= Enter your Project name:
md "%project%"
robocopy c:\web\sample c:\web\%project% /S
This batch file simply asks me for a project name (line 1) that'll be the folder name, then it creates the folder (line 2), creates a copy of an sample folder (which I set up before) and passes the content to the new project folder.
The sample folder contains the structure above and an empty style.scss, and index.php.
This works pretty good and as long as I have most of my files in one direction (XAMPP folder in my case) everything is fine.
If you'd like to use this small script just follow these steps:
- Copy the code into an empty file
- change your sample folder to whatever yours is
- change the directions to your location
- save the file as *.bat inside your web folder
- double click it, enter your project name, hit enter
- your new project folder is created
The only thing that's missing here is the option to load everything in ruby so I can start compass watch
right after I created a project. Any suggestions how to do so?