Batch Files (trying to get a simple FTP script to work) - Techist - Tech Forum

Go Back   Techist - Tech Forum > Computer Software > Microsoft Windows and Software
Click Here to Login
Closed Thread
 
Thread Tools Display Modes
 
Old 07-18-2005, 08:47 PM   #1 (permalink)
Monster Techie
 
Join Date: May 2004
Location: USA
Posts: 1,178
Question Batch Files (trying to get a simple FTP script to work)

I'm pretty newb with this all (batch files--never needed to use it much!), but:

file: get.bat
ftp -s:get.txt server

file: get.txt
userid
password
cmd #1
cmd #2
etc...

The above *works*, but the following doesn't (all in one file instead):

file: get.bat
ftp server
userid
password
cmd #1
cmd #2
etc...

I'm sure it's something simple, but not enough so as I could get an answer out of Google.

Any help is appreciated,
thanks!
__________________

__________________
Vormund is offline  
Old 07-19-2005, 09:57 AM   #2 (permalink)
Monster Techie
 
Join Date: May 2004
Location: /usr/root/mn/us
Posts: 1,118
Default

That's because each line in a batch file needs to be a command.

your userid and password aren't commands, thus they aren't processed. If you wanted to accomplish this task without using that file.txt, you would be better off using a vb script that initiates a shell.

It looks like you have what you need in your file.txt though, since that seems to be the reason it's included in the ftp program.

Is there a reason you'd rather not have the auth info and commands in a text file?
__________________

__________________

Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 07-20-2005, 04:07 AM   #3 (permalink)
Monster Techie
 
Join Date: May 2004
Location: USA
Posts: 1,178
Default

Hi & thanks for the answer!

Nope--I'm just new to using a batch file. I was trying to write a simple program using AutoIt--syncronize my favorites with an easily parsable page on a ftp server--but AutoIt lacks FTP support for now.

I've run into more trouble since using the FTP batch file, so I think I'll have to find another way of doing it.

Thanks!
__________________
Vormund is offline  
Old 07-20-2005, 01:57 PM   #4 (permalink)
Monster Techie
 
Join Date: May 2004
Location: /usr/root/mn/us
Posts: 1,118
Default

I just looked around AutoIT, and loved it. If you really want, you can use autoIT to automate the task of launching some ftp program (WinSCP?), log into the ftp server, select the file to back up and send it.
__________________

Its a frigging Laptop, not a Labtop!!!!
bla!! is offline  
Old 07-20-2005, 02:06 PM   #5 (permalink)
Monster Techie
 
Join Date: May 2004
Location: USA
Posts: 1,178
Default

Well... all I was really trying to do, is have a program run when Internet Explorer (or other browsers--once this is working, lol) is run, check which computer last updated the bookmarks, and syncronize if need be... and in doing that, I was aiming for a background application that nobody would ever notice It's just dumb IE, hah, there are plugins for almost every other browser for this!:x

AutoIt is very nice, for the simple things!

thanks again!
__________________
Vormund is offline  
Old 07-20-2005, 07:34 PM   #6 (permalink)
Master Techie
 
Join Date: Oct 2003
Posts: 2,258
Default

You can do this in perl and make it very small and keep it invisable. Can be a scheduled task or something you run, ie loginscript...

good luck
Inaris is offline  
Old 07-21-2005, 07:02 AM   #7 (permalink)
Newb Techie
 
Join Date: Feb 2005
Posts: 24
Default

Hi,

Dont know if i am on the right end of the stick here, but....

I have written a VBS that copys the favourites of the currently logged on user to a specified location. This stores them in any location you chose, network drive etc etc etc..

This file basically deletes the users favourites folder that is stored on the "network drive" then copys over the new "fresh" version from the c:\ drive every time that (or any other user logs in).
Basically meaning they have an upto date back up of their favourites stored on a network drive. We do this for all users on site so we can restore there favourites after we clone/rebuild or replace a pc for them.

It also means no matter where they are on site they have access to the favourites that are normally located on there local machine and as we store them on a netowrk drive we give them sftp access to the drive they can access them from home/anywhere if required aswell...
If you have sftp'd to a location and mapped that location as a drive, you could use this script to copy the favourites folder from the c:\ drvie to that specified location everytime IE launches (if you shedual it to) or at start up. The user would be unaware of this script running as it runs in silent mode and is currently set to not throw back errors even if it fails or ****s up. (ill add in a REM allowing you to turn this on or off) it runs in under a second on every machine i have tested it on and it completley undetectable to the user.


If i have understood what you want let me know and ill post the script for you.. if i have got it wrong sorry for wasting everybody's time..

Cheers
TheElise is offline  
Old 07-21-2005, 03:00 PM   #8 (permalink)
Monster Techie
 
Join Date: May 2004
Location: USA
Posts: 1,178
Default

o.O That sounds perfect -- so please do post/PM/e-mail it (which ever is easiest to you!), I'd greatly appreciate it.

thank you,
--Xula
__________________
Vormund is offline  
Old 07-22-2005, 06:27 AM   #9 (permalink)
Newb Techie
 
Join Date: Feb 2005
Posts: 24
Default

im not sure this is exactly what you want but ill send it over to you anyway.

This code does exactly what is says in my previous post, but i had a little more time today and read yours again and i think you want something a little more complex.

This code will do the following.

When a user logs on it copys the favourites folder from the local machine and stores them in a location (in this case the N:\ drive) As the N:\ drive is a users person private space on a network that drive can not be accessed by other users. There for ehte code only searches of rthe computer name for example "TheElise" it then stores the favourites on the users N:\ drive as "Favourites TheElise" . If an onther users logs into that same machine, the script will copy their favourites from the local machine to their N:\ drive which is not accessable to any other user to they to will have a folder called "Favourites TheElise" on there N:\ drive.

So here you hit a lsight problem. If you are storing the folders in the same central directory then the script will look at the computer name....for example "TheElise" and look for a folder called "Favourites TheElise" and delete it then re-write it with the ewer version. This is not good if stored on a cetral location because if you logged on with 10.000 favourites on the pc "TheElise" then it would store them for you... if i was to logonto the same pc 10 minutes later it would delete your favourites and replace them with mine. You would ideally need each individual user to have there own private space to store the favourites so they dont get overwitten by the next person.

Or you could ammend thescript slightly and have it insert the user name of the user as well as the computer name so it says

"Favourites John TheElise"
"Favourites Mark TheElise"

That way you know what pc they have been on and you have a copy of there favourites. However by doing this you run the risk of storing millions of folders that are empty if they log into more than one pc you will get multiple entires. such as...

"Favourites John TheElise"
Favourites John BedComp"
"Favourites John LivingComp"
Favourites John KitchenComp"
"Favourites Mark TheElise"
Favourites Mark BedComp"
etc
etc
etc
etc

You see the potential problem here is run on a netowrk as large as ours. Hence the reasson we keep it to compname only on a centrally located private drive.

If you want me to re-write this with the username lookup added ill happily do so, or if the users N:\ drive is private and youll be storing them there then you will have no problem. If you want to create a fodler on the X:\ drive and store everyones favourites there you must ensure that first of all everyone who logs onto the pc has the X:\ drive mapped by default and you will require the users names to be entered other wise the script will keep deleteing previous versions. (this is not an error its designed that way). Also as the script is being run with that users privelages you must ensure they have full read/write access to the drive you are copying the favoutires to. For example the drive would probably be visible in the my computer folder which may lead some users to look in there. Unless you somehow disable it from showing but still have it mapped? then that way they woudnt be able to see the drive or even know it was there but the script would disregard that and look for the X:\ drive and find it as it knows it is there.

Sorry for my spelling i wrote this in about 5 seconds...

let me know what you want me to do?
TheElise is offline  
Old 07-22-2005, 09:52 AM   #10 (permalink)
Super Techie
 
Join Date: Jun 2004
Posts: 330
Send a message via AIM to dumdum8684
Default

AutoIt does have FTP support. Make sure you ahve the latest version...3.1.1

Under Network Functions in the help file is the command InetGet. There is even more support for the networking in the newest beta version. Readup on the InetGet function in the help file.

-Aaron
__________________

__________________

My Computer:
-UV Reactive Acrylic Mid-Size Case
-Thermaltake 420W
-AMD Athlon XP \"Barton\" 3200+ 400MHz
-Cooler Master Aero7+
-Asus A7N8X-E Deluxe Mobo
-nVidia GeForce FX 5700 128MB
-2x Kingston HyperX 512MB PC3200
-2x 200GB WD 7200 8MB SATA
-2x 12\" UV Cold Cathodes
-5x 80MM 4UV LED Blue UV-Reactive Fans


My Laptop:
P3 750MHz, 512MB, CD-RW/DVD Combo, 15.1\" TFT, 20GB HD, 32MB integrated video
dumdum8684 is offline  
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Copyright 2002- Social Knowledge, LLC All Rights Reserved.

All times are GMT -5. The time now is 07:15 AM.


Powered by vBulletin® Version 3.8.8 Beta 1
Copyright ©2000 - 2017, vBulletin Solutions, Inc.