From: Chuck Gelm <nc8q@gelm.net>
To: Stephen Samuel <samuel@bcgreen.com>
Cc: linux-newbie@vger.kernel.org, ray@comarre.com
Subject: Re: renaming really long filenames
Date: Tue, 20 May 2003 18:16:24 -0400 [thread overview]
Message-ID: <3ECAA938.F9E64E91@gelm.net> (raw)
In-Reply-To: 3EC9023F.5080203@bcgreen.com
Hi, Stephen:
Hey, this looks great! Thanks. I'll read up with
"man tr". I am thinking that I would like to translate
spaces to underscores and non-alphanumeric to null.
Stephen Samuel wrote:
>
> My solution would be something like:
>
> for i in * ; do mv "./$i" "`echo ./$i | tr -d '\00-\042\173-\377<>|' `" ; done
>
> Note: I'm deleting characters starting at 7bH, not 6fH -- 6F is in the middle
> of the lower case alphabet, so it doesn't make sense.
>
> Other things to note:
> I'm using octal (base 8) characters in the string, not hex
> the backquote (`) says to run the command and use the output as the
> parameter to (in this case) the 'mv' command.
>
> I'm using './filename' to handle the possibility of a filename starting with
> a '-' and being mistaken for an option. './' says "in the current directory",
> so it's something of a no-op, but guarantees that the name won't start with a '-'.
>
> the double quotes around "./$i" make sure that spaces (and other greeblies) in the
> original filename don't get interpreted as work breaks.
>
> Chuck Gelm wrote:
> > Howdy, Y'all:
> >
> > I have some very long filenames that I would like to shorten.
> > The filenames contain 'spaces' and some characters with tics or
> > apostrophes, and tildes over them. I tried to change them from
> > a console session, but I don't know how to generate those special
> > characters from the keyboard...and I really don't want to type
> > the long filenames anyway. :-|
> > OBTW, I have no GUI (X windows) on this computer.
> >
> > Is there a way to remove all characters < 023h && > 06fh
> > from these filenames?
<snip>
> --
> Stephen Samuel +1(604)876-0426 samuel@bcgreen.com
> http://www.bcgreen.com/~samuel/
> Powerful committed communication, reaching through fear, uncertainty and
> doubt to touch the jewel within each person and bring it to life.
-
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:[~2003-05-20 22:16 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-10 10:09 How do I stop GUI from autoloading? Amin
2003-05-10 13:29 ` Charlotte Miller
2003-05-10 15:09 ` Chuck Gelm
2003-05-10 15:42 ` Ray Olszewski
2003-05-10 16:09 ` Amin
2003-05-10 16:39 ` Ray Olszewski
2003-05-11 13:51 ` sean
2003-05-11 21:14 ` renaming really long filenames Chuck Gelm
2003-05-11 21:44 ` Ray Olszewski
2003-05-19 16:11 ` Stephen Samuel
2003-05-20 22:16 ` Chuck Gelm [this message]
2003-05-19 17:51 ` How do I stop GUI from autoloading? Stephen Samuel
2003-05-19 18:49 ` Richard Adams
2003-05-19 19:07 ` Stephen Samuel
2003-05-19 19:55 ` Richard Adams
2003-05-19 20:39 ` Stephen Samuel
2003-05-19 21:06 ` Richard Adams
2003-05-19 21:14 ` Ray Olszewski
2003-05-20 5:23 ` Richard Adams
2003-05-20 6:19 ` Ray Olszewski
2003-05-20 22:26 ` Chuck Gelm
2003-05-21 22:47 ` Riley Williams
2003-05-10 15:43 ` Amin
2003-05-10 15:50 ` Brian P. Bilbrey
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=3ECAA938.F9E64E91@gelm.net \
--to=nc8q@gelm.net \
--cc=linux-newbie@vger.kernel.org \
--cc=ray@comarre.com \
--cc=samuel@bcgreen.com \
/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