LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-27-2012, 05:14 AM   #1
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Rep: Reputation: 0
Copying files from linux to windows using script.


I am doing some build on Linux machine after the build I need to copy those files to windows. I need to do this using script. How can i achieve this. I have samba server.

If i have samba i can manually copy files by accessing Linux machine as \\linux_machine. This i need to do automatically

I heard something like mapping windows folder in linux and copying files there.

anybody has done this or has idea how to do that?
 
Old 04-27-2012, 05:15 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,516

Rep: Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436
it looks like a simple copy. what have you tried?
 
Old 04-27-2012, 05:16 AM   #3
catkin
LQ 5k Club
 
Registered: Dec 2008
Location: Tamil Nadu, India
Distribution: Debian
Posts: 8,576
Blog Entries: 31

Rep: Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195Reputation: 1195
Do you want the script to run on Windows or Linux?
 
Old 04-27-2012, 05:23 AM   #4
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
thanks for the quick reply

Basically i am interested in mapping windows folder to linux nachine.

i am running this from linux.

@catkin i need the script
 
Old 04-27-2012, 05:28 AM   #5
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,420

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Code:
cp $files //winbox/share

Last edited by descendant_command; 04-27-2012 at 05:30 AM. Reason: doh! slashes
 
Old 04-27-2012, 05:31 AM   #6
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
i tried

scp -r install.log username@ip_address:.

i got connection lost error
 
Old 04-27-2012, 05:33 AM   #7
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
//winbox is computer name rt ?
 
Old 04-27-2012, 05:34 AM   #8
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,516

Rep: Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436
you do not need scp, but a simple copy, just mount the drive before. it works on both linux and windows, only the syntax will differ a bit.
cp -r <source> <dest>
and either source or dest is mounted.
 
Old 04-27-2012, 05:41 AM   #9
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
how can i mount windows folder in linux
 
Old 04-27-2012, 05:43 AM   #10
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 8,516

Rep: Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436Reputation: 2436
just ask google
http://www.howtogeek.com/wiki/Mount_...nux_with_Samba
 
Old 04-27-2012, 05:46 AM   #11
descendant_command
Senior Member
 
Registered: Mar 2012
Posts: 1,420

Rep: Reputation: 369Reputation: 369Reputation: 369Reputation: 369
Yeah sorry, ignore me ... been using windows today...
 
Old 04-27-2012, 05:55 AM   #12
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
getting this error while test connection

session setup failed: NT_STATUS_LOGON_FAILURE
 
Old 04-27-2012, 06:03 AM   #13
xombboxer
Member
 
Registered: Apr 2011
Posts: 63

Original Poster
Rep: Reputation: 0
looks like samba is not there

i check and get back to you guys.. Thanks for help
 
Old 04-27-2012, 06:11 AM   #14
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671Reputation: 671
Put a .credentials file in your HOME directory and refer to it in your /etc/fstab entry options. If you use the uid, gid & user options, you can even mount the directory as a normal user.

Check that you firewall isn't blocking the ports that the samba client uses.

Run "smbclient -l <HOSTNAME>" and see if the windows shares are listed.

The domain/workgroup should match. I'm afraid I don't know where to configure it if you only use a client, but you could an entry in your .credentials file. See man mount or man cifs for details.

You could also use smbclient as a smb ftp client for your script, instead of mounting.

----
To preserve file ownership and permissions, storing a tar ball on the Windows host would be prefered, if you aren't using the files.

Last edited by jschiwal; 04-27-2012 at 07:24 AM.
 
  


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 on copying files and folders from a linux server to a windows server nithin6034 General 6 07-20-2011 08:59 AM
Copying Windows files in Linux yaro137 Linux - General 7 07-23-2010 04:39 PM
Copying windows files to linux investmentbnker75 Linux - General 16 08-22-2008 01:45 PM
copying files from windows to linux susyq78 Linux - Newbie 6 08-10-2003 10:21 PM


All times are GMT -5. The time now is 01: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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration