Using the -c (command) option with smbclient

Allan Green Allan.Green at uhb.nhs.uk
Wed Sep 21 16:15:56 GMT 2005


Hello everyone,

 

The script I wrote a while ago to delete files on a smbclient-accessed
floppy disk has suddenly broken.

 

After some headscratching, it appears that the error occurs as a result
of an unusual filename (e.g. "abc.txt;1"), which includes the suffix
";1".  (Do I recall seeing this ages ago on a Vax system? I'm not sure,
but I think the "1" part is a generation number.)

 

Anyway, my script (generated automatically) includes something like:

 

smbclient //hostname/floppy_a -c "command1 ; command2 ; rm abc.txt;1 ;
command 3"

 

Of course the "';" within the filename is treated as a separator and the
rm fails.  As does the "1" when smbclient tries to treat it as a
command.  I've tried escaping the semicolon with a backslash (but this
just puts the backslash into the file name, not unreasonably!)

 

Anyone got any clues how to protect my script from such devilry?  The
floppies arrive from an external organisation and I have no control over
what is put onto them!

 

With warmest regards,

 

Allan Green

Clinical Scientist

 


DISCLAIMER:
This e-mail and any attachments hereto contains proprietary information, some or all of which may be confidential or legally privileged. It is for the exclusive use of the intended recipient(s) only. If an addressing or transmission error has misdirected this e-mail and you are not the intended recipient(s), please notify the author by replying to this e-mail. If you are not the intended recipient you must not use, disclose, distribute, copy, print, or rely on this e-mail or any attachments, as this may be unlawful.
-------------- next part --------------
HTML attachment scrubbed and removed


More information about the smb-clients mailing list