# Need help with batch file construction



## turbines (Jun 14, 2003)

I know very little about batch file commands and so I would appreciate help with the following.

I need a batch file that will perform the following tasks when executed.

#1 Rename a file located in D:\Image Folder and named "0001.jpg" to "image.jpg".

#2 Upload the file "image.jpg" to a web site directory using windows ftp client.

I think this should be a simple undertaking but I haven't a clue how to go about it.

I am using Windows XP home edition


----------



## StumpedTechy (Jul 7, 2004)

Here is but one way to do it

BTW I did the copy because I amssuming you want to keep the original? or no?
copy "D:\Image Folder\0001.jpg" "D:\Image Folder\image.jpg"
ftp -s:filename "remote computers IP"
If you don't want to keep the file add in-
del "D:\Image Folder\image.jpg"

In the -s:filename create a file and to the ftp commands listed below

http://www.nsftools.com/tips/MSFTP.htm

the put command will allow you to copy a local file up to the ftp server.


----------



## turbines (Jun 14, 2003)

Thanks StumpedTechy for the help

I am still confused about the FTP command lines and switches.

I did realize that there is no need to rename the file. The file on the server will be automatically overwritten with each upload. I just need to upload it and then delete the original file from the local directory after it is uploaded.

I can upload using the following command prompts;

ftp> open home.triad.rr.com
Connected to home.triad.rr.com.
User (home.triad.rr.comnone)): username
331 Password required for username.
Password:*******
230 User name logged in, access restrictions apply.
ftp> binary
200 Type set to I.
ftp> lcd D:\PSRemote
Local directory now D:\PSRemote.
ftp> put 0001.jpg
200 PORT command successful.
150 Opening BINARY mode data connection for '0001.jpg'.
226 Transfer complete.
ftp: 9900 bytes sent in 0.00Seconds 9900000.00Kbytes/sec.
ftp> disconnect
221 Goodbye.

Now I need to figure out how to get this into a batch file and how to delete the original file in the local directory


I disabled smilies in your post, so your code would display correctly.


----------



## turbines (Jun 14, 2003)

Ok I got some of this to work with the following bat and txt files

[psremoteput.bat]
ftp -ssremoteput.txt
exit

[psremoteput.txt]
open home.triad.rr.com
myusername
mypassword
lcd D:\PSremote
put 0001.jpg
quit

Now I just need to figure out how to delete the orignal 0001.jpg file


----------



## Squashman (Apr 4, 2003)

http://www.nsftools.com/tips/MSFTP.htm

mdelete
Deletes one or more files on a remote computer


----------



## gurutech (Apr 23, 2004)

There's a program I use called Booru Webcam. It takes images from a webcam every "x" seconds (or minutes), and can be set to automatically FTP them to a website or whatever....

No need for a batch file!

Website is http://www.booru.net


----------

