C Board  

Go Back   C Board > Platform Specific Boards > Linux Programming

Reply
 
LinkBack Thread Tools Display Modes
Old 04-28-2008, 02:55 AM   #1
Registered User
 
Join Date: Jan 2008
Posts: 35
copy files to samba

My questio is perhaps very fool, but I'm not able to find an answer!!
I 've a server that share a directory with samba.
In my PC I see such directory in ubuntu i.e. smb://server/test.
I need to create a script .sh to copy some files in smb://server/test
So i perform
cp smb://server/test *.txt
but I get an error...
My question is:
How I can copy some files from my local PC to a server samba shared directory by shell commands?

Thanks in advance
Lollo
lollobrigido is offline   Reply With Quote
Old 04-28-2008, 03:01 AM   #2
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Code:
cp smb://server/test *.txt
You can't copy to *.txt - what do you actually want to do?

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 04-28-2008, 03:10 AM   #3
Registered User
 
Join Date: Jan 2008
Posts: 35
Ok, exchanging the operands the result is the same!
cp *.txt smb://server/test
the command tel me that is impossible to create smb://server/test, but that directory already exists and dragging a file in such directory (graphically) it is ok!
Lollo
lollobrigido is offline   Reply With Quote
Old 04-28-2008, 06:31 AM   #4
Cat without Hat
 
CornedBee's Avatar
 
Join Date: Apr 2003
Posts: 8,492
The smb:... directory does not really exist. Not the way the kernel sees it.

You have to distinguish between two file systems here. One is the native Linux file system. It's rooted at / and all its absolute paths are of the form /something/or/other.
The other is your desktop system's virtual file system. In order to transparently support more data sources without having to mount them into the kernel tree, all popular desktop environments (probably Gnome in your case) have a VFS that uses URLs are paths. They map the native kernel tree unto file://... URLs, and then go on and implement additional schemes, like smb://... (SMB or CIFS network file system), fish://... (KDE's ssh/scp-based remote file system), etc.
These VFS URLs work only in programs written for this desktop environment and only if they really use only the DE's file manipulation routines.

Shell utilities such as cp have no ideas what to do with these URLs. They only accept kernel file system paths. This means that if you want to use cp to copy files to a samba share, you have to mount it.
Code:
# mount -t cifs //server/test /mnt/test -o user=username
__________________
All the buzzt!
CornedBee

"There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
- Flon's Law
CornedBee is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with loading files into rich text box blueparukia C# Programming 3 10-19-2007 12:59 AM
added start menu crashes game avgprogamerjoe Game Programming 6 08-29-2007 01:30 PM
fopen vs. _open (for BIG image files) reversaflex C Programming 3 04-01-2007 12:52 AM
Copy files ErikDN C Programming 1 10-09-2004 07:50 PM
reinserting htm files into chm help files verb Windows Programming 0 02-15-2002 09:35 AM


All times are GMT -6. The time now is 07:40 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22