Recursively mput with smbclient

If you want to upload a local directory and its contents under Linux to a network share, commands are as below:

ls -all trunk
total 236
drwxr-xr-x 3 root root 4096 2008-06-05 10:39 .
drwxr-xr-x 30 root root 4096 2008-05-30 17:31 ..
-rw-r--r-- 1 root root 5946 2008-05-13 22:35 dynctrl.txt
-rw-r--r-- 1 root root 736 2008-05-13 22:35 Makefile
drwxr-xr-x 6 root root 4096 2008-05-13 22:35 .svn
-rw-r--r-- 1 root root 145 2008-05-13 22:35 svn-version.sh
-rw-r--r-- 1 root root 8080 2008-05-13 22:35 uvc_compat.h
-rw-r--r-- 1 root root 32939 2008-05-13 22:35 uvc_ctrl.c
-rw-r--r-- 1 root root 52906 2008-05-13 22:35 uvc_driver.c
-rw-r--r-- 1 root root 3862 2008-05-13 22:35 uvc_isight.c
-rw-r--r-- 1 root root 12608 2008-05-13 22:35 uvc_queue.c
-rw-r--r-- 1 root root 5230 2008-05-13 22:35 uvc_status.c
-rw-r--r-- 1 root root 28041 2008-05-13 22:35 uvc_v4l2.c
-rw-r--r-- 1 root root 27313 2008-05-13 22:35 uvc_video.c
-rw-r--r-- 1 root root 23006 2008-05-13 22:35 uvcvideo

smbclient //192.168.1.1/share
Password:
Domain=[HALILDE] OS=[Windows 5.1] Server=[Windows 2000 LAN Manager]
smb: \>

smb: \> recurse
smb: \> prompt
smb: \> mput trunk*

By default recurse option is OFF. Entering recurse command on the smb prompt will toggle this option to ON, and similarly prompt option is ON by default.

Entering prompt option will toggle this option to OFF, so that smbclient will not ask confirmation for each file in the subdirectories. mput will put multiple files matching trunk* pattern on the local filesystem.