-1

Is there a way to automate an upload of files from my local desktop to an external IP address?

Maybe I can write a program in Java/C# that transfers my files from my the local desktop to an external IP address and schedule that program every day for example?

Is this possible?

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Joren Willems
  • 167
  • 1
  • 6
  • 12
  • [This has been answered](http://stackoverflow.com/q/1744444/114147) for C# if you want to write it in code. – invert Aug 01 '12 at 12:18

3 Answers3

1

The magic keyword is crontab.

Langusten Gustel
  • 10,917
  • 9
  • 46
  • 59
1

Since you don't specify your OS, I am going to assume a standard OS (*nix), so you could proceed like this:

Create a Bash script (say myuploads.sh), and in it, you'll automate the uploading of the files of interest to the remote machine.

Something like this:

#!/bin/bash

HOST='1.2.5.7'
USER='us3r'
PASSWD='p4ssword'
FILE_TO_UPLOAD='/path/to/some_file.some'
WHERE_TO_UPLOAD='/remote/path'

ftp -i -n $HOST <<Arul
user ${USER} ${PASSWD}

binary
cd $(WHERE_TO_UPLOAD)
put $(WHERE_TO_UPLOAD)

quit

You can then use a standard cron (job scheduler) to schedule when to periodically upload that file, using say a cron entry like this:

@daily /path/to/script/myuploads.sh >/dev/null

That runs the script once every day at midnight.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
JWL
  • 13,591
  • 7
  • 57
  • 63
0

You mention C#, so for a Windows system, place the FTP commands in a file:

user
<your name>
<your password>
cd pub
bin
mput *
quit

And schedule a job to run ftp -n -s:cmd.file 127.0.0.1.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
invert
  • 2,016
  • 14
  • 20