Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

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

Posted on 2011-09-29
10
Medium Priority
?
410 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 1000 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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This script will sweep a range of IP addresses (class c only, 255.255.255.0) and report to a log the version of office installed. What it does: 1.)      Creates log file in the directory the script is run from (if it doesn't already exist) 2.)      Sweep…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…

963 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