Windows rename

If you have a bash shell, you probably have rename

This would do the job:

rename 's/^99//' 99*

This is as straightforward as it gets: "for all files matching '99*' replace "99" at the beginning (^) of the name by nothing (//)

Groetjes Albert

--
Albert van der Horst, UTRECHT,THE NETHERLANDS 
Economic growth -- being exponential -- ultimately falters. 
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Reply to
Albert van der Horst
Loading thread data ...

Or use the inverted command file trick: make the action for a single file rename-one.bat

" #!/bin/sh if [ -d $1 ] then

mv $1 newname fi done " Test the behevus out of rename-one.bat Then ls 99D* >inverted.bat

Now replace all lines "99Dmies" -> "$1 99Dmies" 1] e.g. sed -e 's/^/$1 ' inverted.bat > temp 2]

and do inverted.bat rename-one-bat

If you want to change the owner of the directories, you can do that with chown.bat left as an exercise to the reader. Hint do that before renaming.

Groetjes Albert

1] experts would do "99Dmies" -> "$1 '99Dmies' $2 $3 $4" to increase usability.

2] experts would pipe, of course.

Disclaimer, this is to get ideas accross. Nothing has been tested.

--
Albert van der Horst, UTRECHT,THE NETHERLANDS 
Economic growth -- being exponential -- ultimately falters. 
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Reply to
Albert van der Horst

yeah, but which rename?

That's the perl rename script, as fas as I can tell a separate install for msys users, but well worth the hassle.

--
This email has not been checked by half-arsed antivirus software
Reply to
Jasen Betts

"rename" is not part of bash. Please say "type rename" to your bash and tell us what type of thing bash thinks it is.

Clifford Heath.

Reply to
Clifford Heath

No one claimed that rename was part of bash. I only said that if some one serves you up the Unix experience with bash, it would be silly to stop there and not give you rename.

I'll tell you what I know it is, don't need bash for that:

It starts like this:

#!/usr/bin/perl -w # # This script was developed by Robin Barker ( snipped-for-privacy@npl.co.uk), # from Larry Wall's original script eg/rename from the perl source. # # This script is free software; you can redistribute it and/or modify it # under the same terms as Perl itself. # # Larry(?)'s RCS header: # RCSfile: rename,v Revision: 4.1 Date: 92/08/07 17:20:30 # # $RCSfile: rename,v $$Revision: 1.5 $$Date: 1998/12/18 16:16:31 $ #

So that is what they call a script, in this case a perl script.

With the man page and all, I never realised it has been a perl script since the dawn of linux.

Groetjes Albert

--
Albert van der Horst, UTRECHT,THE NETHERLANDS 
Economic growth -- being exponential -- ultimately falters. 
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Reply to
Albert van der Horst

So it has nothing to do with bash, as you initially claimed.

Since 2011, to be precise. TWENTY YEARS after the dawn of Linux. Specifically, since the util-linux-ng fork (begun in 2006) was renamed back to replace the defunct linux-ng package.

You are almost completely clueless.

Reply to
Clifford Heath

Are you trolling?

You misunderstood. Since the dawn of linux I've never been interested whether it was a perl script or executable, I just used it. Now I see that the current version is a perl script, who cares?

You have seen the date for the version I uses on an old debian, don't you? You snipped it. Here it is again:

# Larry(?)'s RCS header: # RCSfile: rename,v Revision: 4.1 Date: 92/08/07 17:20:30

So I've used I before the dawn of linux probably on other *x systems.

The file creation date on my ancient Debian for rename is

-rwxr-xr-x 1 root root 2707 Mar 18 2005 /usr/bin/rename

So if anything happened in 2011 around rename it is pretty irrelevant.

Groetjes Albert

--
Albert van der Horst, UTRECHT,THE NETHERLANDS 
Economic growth -- being exponential -- ultimately falters. 
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst
Reply to
Albert van der Horst

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.