need for escape character with smbclient

Paul Crook P.A.Crook at
Sun May 9 16:13:51 GMT 2004


Ran into problems with smbclient  when trying to access files from a friends 
samba share.  He had various files on his system that used both spaces and 
the single quote character (') in the file names, i.e. Guns N' Roses.  
Without an escape character I was unable to correctly address these files.
some of the combinations tried:

smb: \> cd "Guns N' Roses"
  matches the first " and the ' and does cd \Guns N\

smb: \> cd 'Guns N'' Roses' 
  (all single quotes) leaves out the '' pair; does cd \Guns N Roses\

smb: \> cd  'Guns N''' Roses'  
  matches 1st and 2nd single quotes; does cd \Guns N\

smb: \> cd \Guns N' Roses\
  does cd \Guns\ because of the space

I also tried using the normal escape character to escape the quote and/or the 
spaces, but \ is recognised a directory separator in samba (as well as /)

leaving quotes off completely doesn't work because of the spaces.

These problems also occur at the command line where the following also fails
smbclient -N //machine/share -c "ls Guns N' Roses"

though the following works
smbclient -N //machine/share -D "Guns N' Roses" -c ls

I'd suggest either assigning a new escape character or adding a flag that 
allows \ to be used as an escape, you can then always just double it up to 
get the \ character if you needed it.

This was using smbclient version 3.0.3 that comes in samba-3.0.3.  This I 
download, complied and installed in my home directory on a machine running 
Debian woody.



More information about the smb-clients mailing list