I am selling...
Click to view details on eBay
Location:Balcombe, West Sussex
Country:GB
Price:8.50 GBP
Buy It Now
End date:2012-03-15
End time:22:08:25 GMT
Time left:21 days 9:58:14
Listing:Active
Movie Posters
Think!
Our nation must undergo a radical revolution of values beginning with a shift from a "thing-oriented" society to a "person-oriented" society.
- Martin Luther King, Jr. 1967

Batch script a file via FTP

Dirty little Windows hacks that only be done in crude DOS batch script still crop up on a regular basis. Here's one that vexes many hardened hackers: What is the simplest way to send a file to an FTP server using a batch script?

@echo off

: Collect data from a database in CSV file

echo Removing file if it already exists...
del myfile.csv
echo Done.

echo Extracting data...
osql -E -d dxtb -Q "select stuff from sometable" -s "," -o myfile.csv
echo Done.

: Send file to FTP server
echo Sending extracted data...
@ftp -i -s:"%~f0"&GOTO:EOF
open myftpserver
myuserid
mypassword
put myfile.csv
disconnect
bye

Ignore all error warnings that FTP creates. Don't ask what the line @ftp -i -s:"%~f0"&GOTO:EOF does, but it works on 2003/2008!