views:

3085

answers:

2

How do I write a batch file to control psftp, but with a dynamic filename? Overall I'm trying to convert a video file and then upload it to my Apple TV. Here's what I have, it generally works, but the commands don't control psftp, psftp just waits for user input:

echo Convert and Upload to Apple TV file Called %1.mkv

ffmpeg -i %1.mkv -vcodec mpeg4 -acodec ac3 -ab 384k -sameq -s hd720 -t 60 %1.avi

psftp [email protected] -pw aaa
cd downloads/boxee
put %1.avi
quit

I know with the -b flag psftp can call it's own batch file, but I don't know how to get the %1 argument to it. I've seen solutions where a text file is redirected to psftp, but that suffers from the same problem. Also, I'd prefer to have just one file, but having to call a second file would be alright too.

+1  A: 
Shay Erlichmen
the reason is because normally non-passive FTP port 20 and 21 are not exposed open to the internet. its much safer to leave open the SSH port 22 and then use PSFTP to tunnel through that port securely.
djangofan
+2  A: 

I ended up creating a new batch file from the main one that I then told psftp to use:

echo cd downloads/boxee > psftp.bat
echo put "%1.avi" >> psftp.bat
echo quit >> psftp.bat

psftp [email protected] -pw aaa -b psftp.bat
Brad