I had a similar project for a client. I used DataLoader + Batch script file to automate extract / import data from/to Salesforce.
Look a this amazing tutorial to Setting up Automated DataLoader.
http://www.developerforce.com/media/Cheatsheet_Setting_Up_Automated_Data_Loader_9_0.pdf
At the end you'll be able to launch a script (.bat file). Then you can create a Scheduled Task on your server to automate all your processes.
I remember that i had to hard code my SOQL query in the process-conf.xml and my map files. I used Node.js to run some script to read/write DataLoader process-conf.xml file and to create some map file etc... (Another exemple : Creating log files...)
For your MAP FILES :
- EXTRACT : It's not mandatory to use a map file (Your .csv header will be filed by your fields API's names)
- IMPORT : If you specify field API NAME in the header of your .csv file, Salesforce will automatically map your fields with SalesForce.
I hope it will help you !