Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

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
?
408 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

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.
With User Account Control (UAC) enabled in Windows 7, one needs to open an elevated Command Prompt in order to run scripts under administrative privileges. Although the elevated Command Prompt accomplishes the task, the question How to run as script…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

715 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