Need to copy the latest file from Unix server to Shared folder

Hi All,

One job in unix server will generate .csv files daily. I need to copy the latest of these .csv file from the unix server to the shared drive/folder in windows through unix script. My shared folder will look something like
W:\some folder(for example). Could any one of you please help me out with the unix script which will transfer the latest file from unix server to shared folder.

Your help will be much appreciated.

Regards,Jaya

For starters, how is the data accessed? Samba? FTP? SCP?

If it's really a windows file share(samba), then there's things outside the script you'll need to set up first. You'll need to get the directory mounted on your server. How to do that depends on what your server actually is.

Hi Thanks for your quick reply,

The data is accessed through FTP.

---------- Post updated at 09:57 AM ---------- Previous update was at 09:46 AM ----------

As i am new to unix script, can you please tell me how to mount the directory to the unix server?
For you info, i used the below script.

#!usr/bin/ksh
lcd /home/manuownr/temp
USER xxxx
PASSWD xxxxx
prompt n
mput *.*
cd \\auviccf03\temp
exit 0

Here home/manuownr/temp is the unix path(Source) and \auviccf03\temp is the shared drive (Destination)

Okay. And what's your UNIX server?

FTP is not a Windows file share. If it's FTP, you can use ftp and not mount anything.

That KSH script is full of FTP commands and won't work, because FTP is not KSH. You have to feed them into the ftp command, which is different on different versions of UNIX. What's your system?

"\\auviccf03\temp" is probably not a folder you can CD to, you'll need the actual folder not the network one. If you only have the network one then it's not FTP after all.

You've also got the mput before you change directory, which is probably not what you want.

#!/bin/ksh

ftp <<EOF
        lcd /home/manuownr/temp
        USER xxxx
        PASSWD xxxxx
        prompt n
        cd c:\path\to\file
        mput *.*
        quit
EOF