Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Automatically uploading files using smbclient
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
OpelBlitz
Apprentice
Apprentice


Joined: 12 Dec 2002
Posts: 229
Location: Chicago, Illinois

PostPosted: Wed Dec 17, 2003 7:01 am    Post subject: Automatically uploading files using smbclient Reply with quote

I wanted to write a script or something that'll allow me to automatically upload files to an smb share, using mput.

The requirements are as follows:

- Must not require any further user intervention other than running the script.
- Will go into a certain directory on the server
- Will need to upload filenames with 3 different extensions.
- If the filename already exists, smbclient won't overwrite it, ignoring the file, and moves on.

Where do I begin? :)
Back to top
View user's profile Send private message
Spooky Ghost
Apprentice
Apprentice


Joined: 19 Apr 2002
Posts: 210
Location: Bristol, United Kingdom

PostPosted: Wed Dec 17, 2003 10:43 am    Post subject: Reply with quote

This doesn't use mput, it's not something I'm familiar with. However it does seem to meet your requirements....

Depending on who you are running the script is running as you may need to pass uid/gid options in the mount arguments but the mount man page should give more details.


Code:
#!/bin/bash

# Mount the samba share locally
mount -t smbfs /my/mount/point //server/sharename -o username=winusername/domain%password

# Set destination directory
DESTDIR=/my/mount/point/destdir

# Change to file source directory:
cd /my/local/src/dir
for i in *.ext1 *.ext2 *.ext3 ; do
     # If file not exist already copy to win server
     test -f $DESTDIR/$i || cp $i $DESTDIR
done

# Umount samba share
umount /my/mount/point
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum