Solved

Is it possible to have a batch file or script copy files to an HTTP location?

Posted on 2011-09-29
10
403 Views
Last Modified: 2012-05-12
I am creating a web mapping application for a client and would like to create a seamless update process.  Would it be possible to write a batch file or script to copy files to/from "http://website/update_folder" to "c:/some_folder"?  If so please provide an example.

Thanks
0
Comment
Question by:GreyHippo
  • 3
  • 2
  • 2
  • +3
10 Comments
 
LVL 6

Expert Comment

by:Faisal Khan
ID: 36814842
did you try using cuteftp?
0
 
LVL 43

Accepted Solution

by:
Steve Knight earned 250 total points
ID: 36814863
From is easy enough ... wget.exe will do that for you:

http://gnuwin32.sourceforge.net/packages/wget.htm
Then it is effectively:

cd /d c:\somefolder
wget "http://whatever"

As to uploading... you need to probably be using FTP to the server.  Do you have such aaccess?

I haev some examples of scripts for that here:

http://scripts.dragon-it.co.uk/links/batch-ftp-scripting

I prefer this method (it is all in one .cmd batch file) but there are several others on the scripts page.

@echo off
(echo open 110.110.110.110
echo user username
echo password
echo cd /destination/path
echo bin
echo put "C:\Users\Public\ServerDataBackup\FILE.MDBv1.zip"
echo quit
) | ftp -n -i




0
 
LVL 2

Expert Comment

by:junkymail1
ID: 36814875
Currently batch files don't support http requests.  I did do something like you are asking for with the wget program (open source).  It is a popular program and will accomplish what you are looking for in a batch file.

Get it here:
http://gnuwin32.sourceforge.net/packages/wget.htm

Here is an example::
wget -nc -r -o "C:\temp\wget_erros.log" -P "C:\POG IMAGES" https://www.xythosondemand.com/home/SMSB/Shared/ 

Reference site for further information:
http://www.gnu.org/software/wget/manual/wget.html
0
Best Practices: Disaster Recovery Testing

Besides backup, any IT division should have a disaster recovery plan. You will find a few tips below relating to the development of such a plan and to what issues one should pay special attention in the course of backup planning.

 
LVL 9

Expert Comment

by:Lester_Clayton
ID: 36814890
If you've published the update_folder via webdav, the you can create a script which maps a drive to the URL, and then does the necessary copying.

Here's a simple batch file how to do it:

@echo off
net use t: https://Removed.Removed.no\webdav /persistent:no /user:domain\username Pa$$w0rd
copy c:\console.txt t:
net use t: /delete

Open in new window


Here is it in action:

Webdav Result
NOTE: the URL has been obfuscated for security reasons.

Additional Note: Webdav must be HTTPS in order to accept Windows authentication.  The HTTPS certificate may be internal as long as the workstation connecting to it trusts the signer.  

There are many good guides on the net for publishing a webdav folder, if you want to go down this route.
0
 
LVL 6

Expert Comment

by:Faisal Khan
ID: 36814894
you can start with this quick scrip and keep building it.
http://www.c3scripts.com/tutorials/msdos/ftp.html
0
 
LVL 11

Expert Comment

by:paultomasi
ID: 36814937
Yep, easy peasy!...

Here's an example. Just sudstitute your own values for those inside '<...>'...


@ECHO OFF

 >script.ftp ECHO <your username>
>>script.ftp ECHO <your password>
>>script.ftp ECHO LCD <"c:\some folder">
>>script.ftp ECHO CD <"update folder">
>>script.ftp ECHO MGET <your filespec>
>>script.ftp ECHO BYE

FTP -s:script.ftp <ftp.your web address>

DEL script.ftp

Open in new window

0
 
LVL 11

Expert Comment

by:paultomasi
ID: 36814962
Wow!! Beaten to the post once again!

Thought I had this one in the bag. Should have refreshed my browser before posting...
0
 

Author Closing Comment

by:GreyHippo
ID: 36815510
Thanks.  I didn't know about ftp.exe.
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 36815719
Glad to help there!

Steve
0
 
LVL 43

Expert Comment

by:Steve Knight
ID: 36815732
Only thing to watch with ftp.exe is it will only work directly, not through proxy servers and also won't do somethng called "passive mode".  This means it will not work through some sorts of NAT routers to the internet, but will be fine with some, and works on an internal LAN ok.
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Restoring deleted objects in Active Directory has been a standard feature in Active Directory for many years, yet some admins may not know what is available.
While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

829 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question