Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

i have 2 csv files on my windows xp machine that i want to transfer to a unix server every hour (because the 2 files are updated every 30min).

so i search on the web and i found this possibility: to ftp the files from windows to unix using a batch and task scheduler.

i want to know if it's possible to do it from the unix server with a cron job and a simple scipt and not from the windows machine with ftp only (not samba or http) and how to do it.

thanks for your help

share|improve this question
    
Are you sure you can guarantee there won't be file open issues at the time of copy/transfer, if the file is being altered so often? Just want to consider that, otherwise you might want to work with something like rsync to mitigate issues or work on uploading a copy of the files instead of the production files. –  Bart Silverstrim Aug 3 '10 at 15:04
add comment

4 Answers

I use fling for this task (periodical upload files from win to unix).
HTH

share|improve this answer
add comment

Personally I would look at creating a copy of those files on the Windows system so you're not working with potentially open or altering files at the time of copy, mount it as a SAMBA/CIFS share on the UNIX machine, then running rsync via cron to update the copies to a local drive. Or you can bypass the CIFS bit and run rsync if you can run a SSH server on the Windows machine, but the free solutions I've run into like to eat more processor time than it should (maybe that's been fixed.)

Depends on file size and network reliability and how much security you want to put into it.

share|improve this answer
    
u're right, i'll copy them. but can u explain a bit more how to do the rsync via cron and CIFS thing? i'm new to all this stuff. –  daria Aug 3 '10 at 16:04
    
The samba part you'll have to look up for your version/implementation of Linux, as it depends on how you're authenticating and there were slight changes in syntax across versions over time. I have a script that uses something like "sudo mount -t cifs -o user=username,domain=domainname //machineip/sharename /mnt/mountpoint" to mount a share to a machine on an active directory domain. –  Bart Silverstrim Aug 3 '10 at 19:02
    
I have another script used for copying some backup files to another share that I have mounted so my Linux machine acts as a go-between. This one uses "cp -u /mnt/mountpoint/directory/directory/* /mnt/mountpoint/directory" to do that. I used to use rsync, though, with "/use/bin/rsync -avrz --progress /mnt/mntpoint/directory/ /mnt/mountpoint/backupdirectory" as the syntax. You'll want to verify it with the manpage, though, to verify what switches you want. Rsync can be very flexible. Maybe the cp command will work well enough for you, again use the man page to look at the options. –  Bart Silverstrim Aug 3 '10 at 19:04
    
As for cron, your best bet is to google for cron plus your distro name, as you can edit the crontab the way that's expected for your distro with the schedule you want. First, though, test it with a regular script that you chmod +x on so it's executable so you can test that it runs properly. Then worry about cron. And remember to stagger your copy so it won't happen while you're doing your alterations on the files you're copying. Weird stuff can happen if the file is in use and you attempt a file operation on it. –  Bart Silverstrim Aug 3 '10 at 19:06
    
(and if you're new to this stuff, make sure you make backups of things you're playing with...we were all new to this stuff once, and most have probably had more than a couple @#%!! moments saved only by a quick backup...) –  Bart Silverstrim Aug 3 '10 at 19:07
show 1 more comment

Install IIS and enable ftp services on the windows machine. Create a virtual ftp folder that points to the same folder as the csv files use ftp from linux side to get the file from the windows ftp server

share|improve this answer
add comment

I typically would use a CIFS share and a cronjob. Mount the SAMBA share on the UNIX server and put a bash script in cron to utilize it.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.