LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > General
User Name
Password
General This forum is for non-technical general discussion which can include both Linux and non-Linux topics. Have fun!

Notices


Reply
  Search this Thread
Old 07-19-2011, 10:19 PM   #1
nithin6034
LQ Newbie
 
Registered: Jun 2010
Posts: 0

Rep: Reputation: 0
Lightbulb Shell script on copying files and folders from a linux server to a windows server


Hi,

I need a help in writing a SHELL SCRIPT for COPYING FILES AND FOLDERS FROM A LINUX SERVER TO A WINDOWS SERVER using WinSCP.

I have an IP address, username and a password to connect to the Linux server (using WinSCP). From there I am copying the files to the windows server. I want to do this automatically in a daily basis. Pls help me on this...
 
Old 07-19-2011, 10:43 PM   #2
jerryleem412
LQ Newbie
 
Registered: Jul 2011
Posts: 2

Rep: Reputation: Disabled
Well it's my understanding that WinSCP is a program that runs on Windows and provides SFTP and FTP clients. So I would follow the documentation on the WinSCP site http://winscp.net/eng/docs/scripting for scripting. If you need assistance with Linux please explain your question in detail and describe exactly what you stuck on.
 
Old 07-19-2011, 10:50 PM   #3
nithin6034
LQ Newbie
 
Registered: Jun 2010
Posts: 0

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by jerryleem412 View Post
Well it's my understanding that WinSCP is a program that runs on Windows and provides SFTP and FTP clients. So I would follow the documentation on the WinSCP site http://winscp.net/eng/docs/scripting for scripting. If you need assistance with Linux please explain your question in detail and describe exactly what you stuck on.
Using winSCP, I can connect to the linux machine using the IP, username and password. I need a shell script, which can automatically connect to the linux machine and copy the files to the windows machine using SCP.

Last edited by nithin6034; 07-19-2011 at 11:12 PM.
 
Old 07-19-2011, 11:12 PM   #4
jerryleem412
LQ Newbie
 
Registered: Jul 2011
Posts: 2

Rep: Reputation: Disabled
WinSCP is a client, it's not a server. So a shell script initiated from the Linux machine isn't going to be able to connect to WinSCP. Your best bet would be setting up a script or a batch file on the Windows PC and initiate the connection using your WinSCP client. With that said I wouldn't recommend running a FTP server on Windows unless you have a really good firewall or it's on a private network. Now if your hell bent on running a Linux script to transfer files another option would be to use Samba and setup file share(s) on the Windows server. That would be a relativly simple thing to do. Just create a symbolic link to your Windows PC file share then set up a shell cript to copy files into that folder(s).
 
Old 07-19-2011, 11:59 PM   #5
nithin6034
LQ Newbie
 
Registered: Jun 2010
Posts: 0

Original Poster
Rep: Reputation: 0
I need a shell script to copy files frm a linux machine to a windows machine using SCP. The files keeps changing day-to-day. I have to copy the latest file to the windows machine frm the linux machine.

for example : On July 20, the file name will be 20.txt and it should be copied to windows

On July 21, It will become 21.txt and it also should be copied.

I need a script to work this

Last edited by nithin6034; 07-20-2011 at 12:10 AM.
 
Old 07-20-2011, 07:58 AM   #6
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,738
Blog Entries: 37

Rep: Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917
Hi,

Quote:
Originally Posted by nithin6034 View Post
Hi,

I need a help in writing a SHELL SCRIPT for COPYING FILES AND FOLDERS FROM A LINUX SERVER TO A WINDOWS SERVER using WinSCP.

I have an IP address, username and a password to connect to the Linux server (using WinSCP). From there I am copying the files to the windows server. I want to do this automatically in a daily basis. Pls help me on this...
What have you done to find a solution to the problem? Other than to post here.

We will aid you when you help yourself to a solution. Provide us with what you have attempted and then maybe someone will be able to assist. 




FYI: I suggest that you look at 'How to Ask Questions the Smart Way' so in the future your queries provide information that will aid us in diagnosis of the problem or query.

Just a few links to aid you to gaining some understanding. Sure some may seem beyond a newbie but you must start somewhere;





1 Linux Documentation Project
2 Rute Tutorial & Exposition
3 Linux Command Guide
4 Bash Beginners Guide
5 Bash Reference Manual
6 Advanced Bash-Scripting Guide
7 Linux Newbie Admin Guide
8 LinuxSelfHelp
9 Utimate Linux Newbie Guide
10 Linux Home Networking
11 Virtualization- Top 10

The above links and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!
 
Old 07-20-2011, 07:59 AM   #7
onebuck
Moderator
 
Registered: Jan 2005
Location: Summer Midwest USA, Central Illinois, Winter Central Florida
Distribution: SlackwareŽ
Posts: 13,738
Blog Entries: 37

Rep: Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917Reputation: 2917
Moved: This thread is more suitable in <General> and has been moved accordingly to help your thread/question get the exposure it deserves.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Shell script to copy all folders older than 7 days from Linux to Windows by samba blackthu80 Linux - General 4 03-17-2011 12:29 AM
[SOLVED] How to access windows files & folders from Enterprise Linux Server hnpat Linux - Newbie 4 09-23-2009 05:56 AM
how to move files from windows server to linux server by script topsy999 Linux - Newbie 2 01-15-2009 12:40 PM
Copying files from windows clients to linux server sarajevo Linux - Networking 2 05-17-2008 01:18 AM
Writing a shell script for copying file from one server to other by using third serve irfanb146 Linux - Newbie 4 03-07-2008 10:05 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > General

All times are GMT -5. The time now is 06:22 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration