Originally Posted by myint45
I'm trying to write a script to copy files with .config within the file name and transfer it to a windows AD share.
I'm thinking FTP. I don't know much about FTP to put it into a script.
1) How can I setup FTP from Linux to Windows?
2) Is there a way to connect and do multiple files?
3) Can I use $variable to do a loop and then pass it to FTP?
thanks a bunch.
first off, you're better off setting up a real share on the windows machine then mounting that share on the linux machine. This eliminates the need to ftp. The share stuff is done with samba. There's probably a nice GUI in your distro if you're not familiar with mounting a samba share. If not, you'll need to read some docs on samba.
Once that's done, it's simply a matter of copying the files to the windows machine, i.e. "copy *.config /mnt/windows_share/some_dir"
If you want/need to use ftp, a good, scriptable ftp client is ncftp
. It has something called ncftpput which is made for scripting - does an ftp upload, passwords and all, as one command, so you could easily do something like (in tcsh):
foreach f (*.config)
ncfftpput backup_server remote_dir $f
... that will do multiple files.
This, of course, assumes you have an ftp server setup on Windows.