View previous topic :: View next topic |
Author |
Message |
OpelBlitz Apprentice


Joined: 12 Dec 2002 Posts: 229 Location: Chicago, Illinois
|
Posted: Wed Dec 17, 2003 7:01 am Post subject: Automatically uploading files using smbclient |
|
|
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 |
|
 |
Spooky Ghost Apprentice


Joined: 19 Apr 2002 Posts: 210 Location: Bristol, United Kingdom
|
Posted: Wed Dec 17, 2003 10:43 am Post subject: |
|
|
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 |
|
 |
|
|
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
|
|