Solved

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

Posted on 2011-09-29
10
401 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
Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

 
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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
For loop to add numbers 3 75
Compile Error 7 52
knowing when local account expires (Windows Server OS-DOS) 5 71
Questions about DHCP migration 5 61
This article is the result of a quest to better understand Task Scheduler 2.0 and all the newer objects available in vbscript in this version over  the limited options we had scripting in Task Scheduler 1.0.  As I started my journey of knowledge I f…
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.
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 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