From: Flemming Greve Skovengaard <dsl58893@vip.cybercity.dk>
To: linux-newbie <linux-newbie@vger.kernel.org>
Cc: James Miller <jamtat@mailsnare.net>
Subject: Re: convert windows file names
Date: Fri, 15 Apr 2005 20:17:35 +0200 [thread overview]
Message-ID: <4260053F.7070709@vip.cybercity.dk> (raw)
In-Reply-To: <Pine.LNX.4.61.0504151126000.5717@localhost.localdomain>
James Miller wrote:
> I tried your perl script and it works really well, Flemming. Thanks for
> bringing it to my attention. I see it works for all files in a given
> directory--exactly what I need. Now, in place of something like
>
> Patrick\ Cohen\ \&\ Mosaiques\ Quartet\ -\ Quintet\ For\ Piano\ \&\
> Strings\ In\ D\ Major\,\ Op.565\,\ G411\ -.\ Andante\ Come\ Prima.mp3
>
> I get
>
> Patrick_Cohen__and__Mosaiques_Quartet_-_Quintet_For_Piano__and__Strings_In_D_Major._Op.565._G411_-._Andante_Come_Prima.mp3
>
>
> --a big step in the right direction. But I'm still getting some wierd
> characters in there-- and . Are these unicode or something? Anyway,
> I can't reproduce these at the command line. Is there any way your
> script might be made to catch and replace symbols like these as well (I
> mean, for someone who knows absolutely nothing about Perl, and precious
> little about scripting in general)? I have no idea what information
> these symbols are supposed to be representing. It's probably so
> inconsequential I don't even need it, so replacing it with virtually any
> other symbol should suffice. I'd say I've got at least 20 files with
> such symbols, and more are on the way.
>
> Thanks, Jam
> es
This should remove the characters in question.
Replace the if-statement with this on:
if ($new_name =~ m/(?:^[-+]|[^-\w.])/ ) {
and add this line below the other $new_name... lines:
$new_name =~ s/[^-\w.]//g;
I have only tested this very little, but the corrections removes anything
that is not a hyphen (-), a word character (A-Za-z_) or a period (.).
--
Flemming Greve Skovengaard FAITH, n.
a.k.a Greven, TuxPower Belief without evidence in what is told
<dsl58893@vip.cybercity.dk> by one who speaks without knowledge,
4112.38 BogoMIPS of things without parallel.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next prev parent reply other threads:[~2005-04-15 18:17 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-15 15:04 convert windows file names James Miller
2005-04-15 15:15 ` Flemming Greve Skovengaard
2005-04-15 16:37 ` James Miller
2005-04-15 17:16 ` J.
2005-04-15 18:17 ` Flemming Greve Skovengaard [this message]
2005-04-15 19:29 ` James Miller
2005-04-15 15:39 ` Peter
2005-04-15 16:48 ` Ray Olszewski
2005-04-15 18:49 ` James Miller
2005-04-15 18:00 ` chuck gelm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4260053F.7070709@vip.cybercity.dk \
--to=dsl58893@vip.cybercity.dk \
--cc=jamtat@mailsnare.net \
--cc=linux-newbie@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox