How to send file from windows to UNIX daily?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to send file from windows to UNIX daily?
# 1  
Old 03-27-2014
How to send file from windows to UNIX daily?

Hi All!

I am trying to write a little script that should go to a windows server get one file and put on a unix server, but I am not sure if it is the right way please help:
Code:
#! /usr/bin/sh
HOST=10.100.48.41
USER=ftp_hm
PASSWD=P@$$w0rd

ftp -n $HOST
quote user $USER
quote pass $PASSWD
mget Shipment.csv
bye
END_SCRIPT
exit 0

# 2  
Old 03-27-2014
# 3  
Old 03-27-2014
If file is on a CIFS share eg pcshare on windows host pchost you can fetch it from the unix side:

Code:
smbclient -U pcuser%pcuserPASS //pchost/pcshare -c "get Shipment.csv"

# 4  
Old 03-27-2014
Hi

Thank you for your inputs, but it seems that most of your examples are mainly to put files, but what I want is really a script running on unix that will go to a windows 2008 get a file

---------- Post updated at 10:04 AM ---------- Previous update was at 10:01 AM ----------

@Chubler_XL

I am not used to
Code:
smbclient

, but when I try
Code:
 smbclient -L 10.100.48.41
params.c:OpenConfFile() - Unable to open configuration file "/etc/samba/smb.conf":
        No such file or directory
smbclient: Can't load /etc/samba/smb.conf - run testparm to debug it

# 5  
Old 03-27-2014
I think an empty /etc/samba/smb.conf file is all you need here.
# 6  
Old 03-27-2014
Ok, I will create that, but I want to explore both set of options... can I have some also on the script running on the unix to go and fetch a
Code:
*.csv

on a windows directory.
# 7  
Old 03-27-2014
Quote:
Originally Posted by fretagi
Thank you for your inputs, but it seems that most of your examples are mainly to put files, but what I want is really a script running on unix that will go to a windows 2008 get a file
You really can't imagine replacing the put command with get command? OK, instead of this...
Code:
#! /usr/bin/ksh

HOST=remote.host.name
USER=whoever
PASSWD=whatever

exec 4>&1
ftp -nv >&4 2>&4 |&

print -p open $HOST
print -p user $USER $PASSWD
print -p cd directory
print -p binary
print -p put tar.gz
print -p bye

wait
exit 0

you would need this...
Code:
#! /usr/bin/ksh

HOST=remote.host.name
USER=whoever
PASSWD=whatever

exec 4>&1
ftp -nv >&4 2>&4 |&

print -p open $HOST
print -p user $USER $PASSWD
print -p cd directory
print -p binary
print -p get tar.gz
print -p bye

wait
exit 0

Now I realize that your file may not be named tar.gz and your system may not be named remote.host.name. But try to use a little imagination here and adapt the example to your specific needs.
This User Gave Thanks to Perderabo For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Bash for checking and copy Daily files and send an email

Hello, Trying to get a bash for files received on daily basis and want to copy those files to different directory and send an email notification if file exists then send the file counts else Alert with no file received. FileName format: DailyTransaction_2015-03-09_ 200.csv before 200 their is... (1 Reply)
Discussion started by: krux_rap
1 Replies

2. Red Hat

UNIX script for daily file transfer ???

I need to create a script which needs to transfer the "<filename>+yyyymmdd".dat file from a unix machine to a linux machine.. daily. we can use an active batch to schedule the script. however, the script needs to detect if the new file is present, if present, then transfer. any help ?? (1 Reply)
Discussion started by: ravikodi
1 Replies

3. UNIX Desktop Questions & Answers

Can Unix access Windows' File through Command Prompt in Unix

Hi all, I wish to know whether Unix can access window's file in Unix's terminal? Apart from that, how to copy files or share files between Window and Unix? I get to know of secure copy, however, my company's Unix does not support the feature of secure copy? Any other method for me to share/... (5 Replies)
Discussion started by: jessy83
5 Replies

4. Shell Programming and Scripting

UNIX script to FTP file from UNIX server to windows

Hi, I am new to this subject.....Can someone please help me out with the script... unix usernm "sdhftst" unix pwd "chsd13" windows usernm "dfghtst" windows pwd "chsd13" path..../xxx/xxxxx/xxxxxx/xxxxxxx please can u get me a script...its only one file to get ftp. Thanks... (2 Replies)
Discussion started by: himakiran9
2 Replies

5. Shell Programming and Scripting

Batch job in unix server to move the pdf file from unix to windows.

Hi Experts, I have a requirement where i need to setup a batch job which runs everymonth and move the pdf files from unix server to windows servers. Could some body provide the inputs for this. and also please provide the inputs on how to map the network dirve in the unix like that... (1 Reply)
Discussion started by: ger199901
1 Replies

6. UNIX for Dummies Questions & Answers

Send Text message from unix to windows

Hi Buddies, I have a unix client and want to send a message (containg some data) to a windows Database server to query from it and return the result. I shall be so thankfull if you help me out.:b::) Warm Regards, Jessi (1 Reply)
Discussion started by: jessica-adams
1 Replies

7. Shell Programming and Scripting

How send a file from UNIX to Windows with FTP

Hi I'm new working in UNIX, So, I want to know How I can send a file from UNIX to Windows server with FTP. This is my script. ftp -i -n -v <<** open 199.99.99.99 user user1 password1 lcd C01_07_06 /* source/ cd //199.98.98.98/group1/reports /*destination*/ put file1.sh ... (1 Reply)
Discussion started by: edzela
1 Replies

8. UNIX for Dummies Questions & Answers

How to send a trigger file from Unix to Windows

I need to send a file from a Unix box to a Windows sever to kick off a Crystal Reports job. Any good ideas how to do this? Can it be done with FTP? (0 Replies)
Discussion started by: robw95
0 Replies

9. UNIX for Dummies Questions & Answers

How do I send a file as an attachment (gzip file) on a Unix system

Hi, How do I send a file as an attachment (gzip file) on a Unix system ? Using sendmail. Please help me. :confused: (3 Replies)
Discussion started by: lacca
3 Replies

10. UNIX for Dummies Questions & Answers

send file from UNIX to windows across network

Is there an easy way (besides samba) to send a file from a unix server to a win98 machine across a network. I am on a SCO server and need to send the file to a windows machine so the program on the machine does not keep on looking for it on my server. It checks for a new file every couple of... (5 Replies)
Discussion started by: umpi_97
5 Replies
Login or Register to Ask a Question