[CLUE-Tech] RE: removing spaces from filenames?

Friedman, Jason Jason.Friedman at janus.com
Mon Nov 18 13:20:48 MST 2002


This one was tricky, imho.  I used find's depth command to work in
reverse order, since once one changes a directory name the previous
output of find will no longer point to a real file.  I piped find's
output into the perl script.

Here's some sample output:

$ find . -depth -print | perl /path/to/this_perl_script.plx

mv "./o d/a pp ong.set" "./o d/a_pp_ong.set"
mv "./o d" "./o_d"
mv "./te p" "./te_p"


And, here's the perl script:

#!/usr/bin/perl
use strict;
while ( <> ) {
        chomp;
        if ( / / ) {
                my @path = split( /\//, $_ );
                my $base = pop( @path );
                my $path = join( "/", @path );
                my $old = $base;
                ( my $new = $old ) =~ s/ /_/g;
                if ( $new ne $old ) {
                        print( qq|mv "$path/$old" "$path/$new"| );
                        print "\n";
                        system( qq|mv "$path/$old" "$path/$new"| );
                }
        }
}


Thank you,
Jason Friedman
303-782-3560
303-259-2792 (pager) 

-----Original Message-----
From: clue-tech-request at clue.denver.co.us
[mailto:clue-tech-request at clue.denver.co.us] 
Sent: Monday, November 18, 2002 12:00 PM
To: clue-tech at clue.denver.co.us
Subject: CLUE-Tech digest, Vol 1 #856 - 9 msgs


Send CLUE-Tech mailing list submissions to
	clue-tech at clue.denver.co.us

To subscribe or unsubscribe via the World Wide Web, visit
	http://clue.denver.co.us/mailman/listinfo/clue-tech
or, via email, send a message with subject or body 'help' to
	clue-tech-request at clue.denver.co.us

You can reach the person managing the list at
	clue-tech-admin at clue.denver.co.us

When replying, please edit your Subject line so it is more specific
than "Re: Contents of CLUE-Tech digest..."


Today's Topics:

   1. removing spaces from filenames? (Dave Price)
   2. Re: Belated alpha question. (David Anselmi)
   3. Re: removing spaces from filenames? (Randy Arabie)
   4. WEP security? (Sean LeBlanc)
   5. Re: WEP security? (Randy Arabie)
   6. Re: removing spaces from filenames? (Dave Price)
   7. Re: removing spaces from filenames? (Jed S. Baer)
   8. gensup, was: Re: [CLUE-Tech] removing spaces from filenames? (Dave
Price)
   9. 'theaded' weblog (Dave Price)

--__--__--

Message: 1
Date: Sun, 17 Nov 2002 13:14:22 -0700
To: clue-tech <clue-tech at ta8.techangle.com>
From: Dave Price <davep at kinaole.org>
Subject: [CLUE-Tech] removing spaces from filenames?
Reply-To: clue-tech at clue.denver.co.us

Hi,

I have a _bunch_ of files that were created on a windoze system with
embedded spaces in their names.  Can anyone recommend a technique to
programmatically rename the files - replacing ' ' with '_' on both the
file and dir names?

I am thinking perl, but I am not sure what sysntax I would need to use
to search and rename.

TIA

aloha,
dave


--__--__--

Message: 2
Date: Sun, 17 Nov 2002 13:17:11 -0700
From: David Anselmi <anselmi at americanisp.net>
To: clue-tech at clue.denver.co.us
Subject: Re: [CLUE-Tech] Belated alpha question.
Reply-To: clue-tech at clue.denver.co.us

Adam Bultman wrote:
[...]
> 
> /dev/sda :  all for / [ leaving a few megs for aboot ]

200 sectors is all you need for aboot, if you were wondering.

Dave


--__--__--

Message: 3
Date: Sun, 17 Nov 2002 13:29:18 -0700
From: Randy Arabie <randy at arabie.org>
To: clue-tech at clue.denver.co.us
Subject: Re: [CLUE-Tech] removing spaces from filenames?
Reply-To: clue-tech at clue.denver.co.us


--LwW0XdcUbUexiWVK
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sunday, 17 November 2002 at 13:14:22 -0700, Dave Price wrote:
> Hi,
>=20
> I have a _bunch_ of files that were created on a windoze system with
> embedded spaces in their names.  Can anyone recommend a technique to
> programmatically rename the files - replacing ' ' with '_' on both the
> file and dir names?
>=20
> I am thinking perl, but I am not sure what sysntax I would need to use
> to search and rename.

Did you search the clue.denver.co.us mail archives?  Jed posted
something doing that...I'm pretty sure.  I don't recall if it was
clue-tech or clue-talk.

Maybe he will chime in ;-)
--=20
Allons Rouler!
       =20
Randy

--LwW0XdcUbUexiWVK
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE91/we/NC86/lnDu4RAkw/AKCdAy/dvd492S3rsr3HYB8jtUixiQCgt9SG
aSqHJKKV+mu6px7CY7xKjIc=
=Wx+/
-----END PGP SIGNATURE-----

--LwW0XdcUbUexiWVK--

--__--__--

Message: 4
Date: Sun, 17 Nov 2002 16:44:30 -0700
From: Sean LeBlanc <seanleblanc at americanisp.net>
To: clue-tech at clue.denver.co.us
Subject: [CLUE-Tech] WEP security?
Reply-To: clue-tech at clue.denver.co.us

I was trying to enable WEP on my laptop to discourage wardrivers or
neighbors from trying to hijack my wireless network, but the
wicontrol(8)
man page says this...wicontrol is what is used on FreeBSD, BTW, to set
up
wireless configuration.

I knew WEP was on shaky ground, but this makes it sound like cracking
WEP is
trivial. Has anyone been cracked at work or at home, and if so, how did
you
find out about it?

======
BUGS 

The WEP encryption method has been broken so that third parties can
recover the keys in use relatively quickly at distances that are
surpris-
ing to most people.  Do not rely on WEP for anything but the most basic,
remedial security.  IPSEC will give you a higher level of security and
should be used whenever possible.  Do not trust access points or
wireless
machines that connect through them as they can provide no assurance that
the
traffic is legitimate.  MAC addresses can easily be forged and should
therefore not be used as the only access control.

 The attack on WEP is a passive attack, requiring only the ability to
sniff packets on the network.  The passive attack can be launched at a
distance larger, up to many miles, than one might otherwise expect given
a
specialized antenna used in point to point applications.  The attacker
can
recover the keys from a 128-bit WEP network with only 5,000,000 to
6,000,000
packets.  While this may sound like a large number of packets, emperical
evidence suggests that this amount of traffic is generated in a few
hours on
a partially loaded network.  Once a key has been compro- mised, the only
remedial action is to discontinue it and use a new key.

 See http://www.cs.rice.edu/~astubble/wep/wep_attack.html for details of
the attack.

 If you must use WEP, you are strongly encouraged to pick keys whose
bytes
are random and not confined to ASCII characters.

-- 
Sean LeBlanc:seanleblanc at americanisp.net  
http://users.americanisp.net/~seanleblanc/
Get MLAC at: http://sourceforge.net/projects/mlac/
Computers make very fast, very accurate mistakes. 
(contributed by Frank v Waveren) 

--__--__--

Message: 5
Date: Sun, 17 Nov 2002 17:19:05 -0700
From: Randy Arabie <randy at arabie.org>
To: clue-tech at clue.denver.co.us
Subject: Re: [CLUE-Tech] WEP security?
Reply-To: clue-tech at clue.denver.co.us


--rz+pwK2yUstbofK6
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Sunday, 17 November 2002 at 16:44:30 -0700, Sean LeBlanc wrote:
> I was trying to enable WEP on my laptop to discourage wardrivers or
> neighbors from trying to hijack my wireless network, but the
wicontrol(8)
> man page says this...wicontrol is what is used on FreeBSD, BTW, to set
up
> wireless configuration.
>=20
> I knew WEP was on shaky ground, but this makes it sound like cracking
WEP=
 is
> trivial. Has anyone been cracked at work or at home, and if so, how
did y=
ou
> find out about it?
>=20
> =3D=3D=3D=3D=3D=3D
> BUGS=20
>=20
> The WEP encryption method has been broken so that third parties can
> recover the keys in use relatively quickly at distances that are
surpris-
> ing to most people.  Do not rely on WEP for anything but the most
basic,
> remedial security.  IPSEC will give you a higher level of security and
> should be used whenever possible.  Do not trust access points or
wireless
> machines that connect through them as they can provide no assurance
that =
the
> traffic is legitimate.  MAC addresses can easily be forged and should
> therefore not be used as the only access control.

<--snip-->

I have no experience with WEP, definately none WRT cracking it ;-)

But, I have read in numerous places that it is in no way secure.  I=20
would use IPSEC, as recommended in the notes above.
--=20
Allons Rouler!
       =20
Randy

--rz+pwK2yUstbofK6
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE92DH5/NC86/lnDu4RAllMAKCPLVNowHZzc665bj0JEJEUWXeROgCcCsBt
ugtEjeZ/4oFVPewJqydWcPk=
=WL4p
-----END PGP SIGNATURE-----

--rz+pwK2yUstbofK6--

--__--__--

Message: 6
Date: Mon, 18 Nov 2002 10:46:59 -0700
To: "Jed S. Baer" <thag at frii.com>, clue-tech
<clue-tech at ta8.techangle.com>
Subject: Re: [CLUE-Tech] removing spaces from filenames?
From: Dave Price <davep at kinaole.org>
Reply-To: clue-tech at clue.denver.co.us

On Sun, Nov 17, 2002 at 03:04:34PM -0700, Jed S. Baer wrote:
> 
> ls | awk '{print "mv " $1, gensub(" "),"_",1,$1)}' | sh
> 
> jed
> 
I get 'extra spaces' and 'function gensub never defined' errors

Ideas?

aloha,
dave


--__--__--

Message: 7
Date: Mon, 18 Nov 2002 10:51:46 -0700
From: "Jed S. Baer" <thag at frii.com>
To: Dave Price <davep at kinaole.org>
Cc: clue-tech at ta8.techangle.com
Subject: Re: [CLUE-Tech] removing spaces from filenames?
Organization: linked
Reply-To: clue-tech at clue.denver.co.us

On Mon, 18 Nov 2002 10:46:59 -0700
Dave Price <davep at kinaole.org> wrote:

> On Sun, Nov 17, 2002 at 03:04:34PM -0700, Jed S. Baer wrote:
> > 
> > ls | awk '{print "mv " $1, gensub(" "),"_",1,$1)}' | sh

Oops, extra paren inside the argument list.
gensub(" ","_",1,$1)

jed
-- 
We're frogs who are getting boiled in a pot full of single-character
morphemes, and we don't notice. - Larry Wall; Perl6, Apocalypse 5

--__--__--

Message: 8
Date: Mon, 18 Nov 2002 11:05:01 -0700
To: "Jed S. Baer" <thag at frii.com>, clue-tech
<clue-tech at ta8.techangle.com>
Subject: gensup, was: Re: [CLUE-Tech] removing spaces from filenames?
From: Dave Price <davep at kinaole.org>
Reply-To: clue-tech at clue.denver.co.us

On Mon, Nov 18, 2002 at 10:51:46AM -0700, Jed S. Baer wrote:
> > > 
> > > ls | awk '{print "mv " $1, gensub(" "),"_",1,$1)}' | sh
> 
> Oops, extra paren inside the argument list.
> gensub(" ","_",1,$1)
> 
Whare is gensub() defined?

[davep at dp:~]$ cat bin/aren
#!/bin/bash
ls | awk '{print "mv " $1, gensub(" ","_",1,$1)}' | sh


[davep at dp:~]$ aren "Dir with Spaces"
awk: line 2: function gensub never defined

aloha,
dave


--__--__--

Message: 9
Date: Mon, 18 Nov 2002 11:26:26 -0700
To: clue-tech <clue-tech at ta8.techangle.com>
From: Dave Price <davep at kinaole.org>
Subject: [CLUE-Tech] 'theaded' weblog
Reply-To: clue-tech at clue.denver.co.us

CLUEbies,

I have been playing with phpweblog, and like it, but I really wish it
could do a more nested/threaded layout. i.e. Ability to define top-level
folders and then subjects withing those.

Does anyone know of a blog that has this built-in?  Would prefer
php/mysql- based.

aloha,
dave



--__--__--

_______________________________________________
CLUE-Tech mailing list
CLUE-Tech at clue.denver.co.us
http://clue.denver.co.us/mailman/listinfo/clue-tech


End of CLUE-Tech Digest





More information about the clue-tech mailing list