def scp_remote_escape(filename):
 escape_chars = ' !"$&\'()*,:;<=>?[\\]^`{|}'
 new_name = []
 for char in filename:
  if (char in escape_chars):
   new_name.append(('\\%s' % (char,)))
  else:
   new_name.append(char)
 return utils.sh_escape(''.join(new_name))

def scp_remote_escape ( filename ) : escape_chars = ' !"$&\'()*,:;<=>?[\\]^`{|}' new_name = [ ] for char in filename : if ( char in escape_chars ) : new_name . append ( ( '\\%s' % ( char , ) ) ) else : new_name . append ( char ) return utils . sh_escape ( '' . join ( new_name ) )
escape special characters from a filename so that it can be passed to scp as a remote file .