LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-25-2014, 04:34 AM   #1
aabfm
Member
 
Registered: Jan 2006
Location: Portugal
Distribution: Mint, Ubuntu, Knoppix
Posts: 64

Rep: Reputation: 15
Question Copy newest 2 files from Ubuntu to Windows server


Hi all,
After creating the backup files both from my MySQL database and my online app, I'd like to backup them into my Windows office server.
For that purpose I came up with a script that does all of this but I can't get no copy at all of those files on the server.
Here is that bit of the script that I thought should have done that:

Code:
find -name 'bck*.tgz' -type f -mmin -10 -exec smbclient \\\sbs\\officeserv\\app_backups -u myuser@officeserv.local -p welcome123 -c "; prompt; put "{}"; exit" \;
If I run only the command
Code:
find -name 'bck*.tgz' -type f -mmin -10
it will actually return those two files, however I haven't been able to copy them to the server.
Can you help me?
Thanks
 
Old 09-25-2014, 12:35 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,676

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
The basic syntax for coping files via smbclient is
smbclient //host/share -U username -P password -c "put source destination"

So to copy files via find is:
find -name 'bck*.tgz' -type f -exec smbclient //host/share -U username -P password -c "put {} /{}" \;

You can also use a credentials file instead of username password.
 
Old 09-26-2014, 07:56 AM   #3
aabfm
Member
 
Registered: Jan 2006
Location: Portugal
Distribution: Mint, Ubuntu, Knoppix
Posts: 64

Original Poster
Rep: Reputation: 15
Unhappy Oops... Not yet...

Thanks, for your support but unfortunatelly it doesn't work.
I even tried to change the / or // by \ or \\ but nothing...
Any ideas?
 
Old 09-26-2014, 07:59 AM   #4
aabfm
Member
 
Registered: Jan 2006
Location: Portugal
Distribution: Mint, Ubuntu, Knoppix
Posts: 64

Original Poster
Rep: Reputation: 15
Question Other option

It doesn't have to be with 'find', I just want to copy the 2 files that were previously created with the script...
Any ideas?
Thanks
 
Old 09-26-2014, 07:59 AM   #5
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,676

Rep: Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892Reputation: 5892
Have you tried copying the files by just using the smbclient command? If so what were the errors?
 
  


Reply

Tags
copy, find, samba


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
Cannot copy files > 2 GB to NFS mount on Ubuntu 12.04 server taylorkh Linux - Server 4 09-03-2013 07:58 AM
How to copy the files from Windows xp machine to Redhat linux ftp Server arun.ee1988 Linux - Newbie 7 05-14-2013 08:23 AM
Can I copy files from a ntfs drive on ubuntu server? Vodkaholic1983 Linux - Newbie 7 05-05-2013 06:03 AM
Copy "new files found" on my debain (Server) to windows 7 (Home PC) Vodkaholic1983 Linux - Newbie 6 05-13-2012 12:09 AM
How do I copy files from Windows workstations to an Ubuntu server with VSS support? Syllinger Linux - Server 1 12-20-2011 12:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:03 AM.

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