This is the mail archive of the
cygwin
mailing list for the Cygwin project.
Re: Handling special characters (\/:*?"<>|) gracefully
- From: Igor Peshansky <pechtcha at cs dot nyu dot edu>
- To: "Hicks,Mike" <Mike_Hicks at securecomputing dot com>
- Cc: cygwin at cygwin dot com
- Date: Tue, 23 May 2006 15:14:22 -0400 (EDT)
- Subject: Re: Handling special characters (\/:*?"<>|) gracefully
- References: <2ED63F31975E1E428B3732A68923F480ECA6FC@rain.scur.com>
- Reply-to: 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@cs.nyu.edu | igor@watson.ibm.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/