delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2006/05/23/15:15:41

X-Spam-Check-By: sourceware.org
Date: Tue, 23 May 2006 15:14:22 -0400 (EDT)
From: Igor Peshansky <pechtcha AT cs DOT nyu DOT edu>
Reply-To: cygwin AT cygwin DOT com
To: "Hicks,Mike" <Mike_Hicks AT securecomputing DOT com>
cc: cygwin AT cygwin DOT com
Subject: Re: Handling special characters (\/:*?"<>|) gracefully
In-Reply-To: <2ED63F31975E1E428B3732A68923F480ECA6FC@rain.scur.com>
Message-ID: <Pine.GSO.4.63.0605231513110.16854@access1.cims.nyu.edu>
References: <2ED63F31975E1E428B3732A68923F480ECA6FC AT rain DOT scur DOT com>
MIME-Version: 1.0
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Tue, 23 May 2006, Hicks,Mike wrote:

> There are a number of special characters that cannot be used in
> filenames on the NTFS filesystem, this includes backslash (\), slash
> (/), colon (:), asterisk (*), question mark (?), double-quote ("),
> less- and greater-than (<>), and pipe (|).  In contrast, most Unix
> systems only prevent the use of slash characters in filenames
> themselves, since that is used as the separator between levels in
> directory hierarchy.
>
> I like to listen to music while at work, where I run Windows with
> Cygwin.  I periodically like to use 'scp' (secure copy, from the SSH
> suite) to download music from my home computer, where I run Linux.
> Some of my music files at home have special characters in them (in
> particular, colon, question mark, and double-quote have appeared most
> frequently).  When I attempt to use scp to download a file with one of
> these characters in the name, it appears that an open() or write()
> function fails with the error "No such file or directory."
>
> Is there a way to get scp to convert the filename to something that can
> be written to disk?  For example, either removing the characters from
> the filename or converting them to underscores would work fine for me.
> A system-wide option would be great, perhaps controlled by an
> environment variable or two.  Otherwise, each program that can write
> files from foreign sources would have to be rewritten.  It would also
> be an improvement to see a more descriptive error than "No such file or
> directory", though I suppose developers would be hesitant to expand
> upon the standard list of error types.
>
> As a workaround, I find it is easiest to create a zip file on my home
> system with the files I want to transfer, then simply unzip it on my
> work machine.  Cygwin's 'unzip' utility appears to handle this
> situation correctly and will convert unusable characters to
> underscores.  I've tried doing the same thing with a tar file, but
> 'tar' exhibits the same problems as 'scp' and will not write files that
> originally had a special character in the name.
>
> Apologies if there's already a good method for handling this situation
> (other than renaming my original files, thanks).  I did a requisite
> Google search and some thumbing through man pages, but didn't come
> across anything (though that doesn't mean there wasn't anything
> there...).

You're in luck: "PAGER='less +/managed' man mount".
Once you have the files on a managed mount, you might also want to look
into using the "cygstart" utility.
	Igor
-- 
				http://cs.nyu.edu/~pechtcha/
      |\      _,,,---,,_	    pechtcha AT cs DOT nyu DOT edu | igor AT watson DOT ibm DOT com
ZZZzz /,`.-'`'    -.  ;-;;,_		Igor Peshansky, Ph.D. (name changed!)
     |,4-  ) )-,_. ,\ (  `'-'		old name: Igor Pechtchanski
    '---''(_/--'  `-'\_) fL	a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!

"Las! je suis sot... -Mais non, tu ne l'es pas, puisque tu t'en rends compte."
"But no -- you are no fool; you call yourself a fool, there's proof enough in
that!" -- Rostand, "Cyrano de Bergerac"

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019