File renaming utility
Moderator: General Moderators
File renaming utility
Anybody know of a good free utility that allows you to rename files in your file system based on regular expressions? Thanks!
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
Many moons ago I wrote a small utility to do do just that, then I searched for something similar before I posted to my then favourite site and found this:
http://www.codeproject.com/shell/shswapl.asp
You may also might might to have a look around here:
http://www.shellcity.net/
Cheers
http://www.codeproject.com/shell/shswapl.asp
You may also might might to have a look around here:
http://www.shellcity.net/
Cheers
THE Rename
It's been a while since I used it but make sure you choose the type of Regexp (Perl/Posix) you want in the Preferences for best results.
It's been a while since I used it but make sure you choose the type of Regexp (Perl/Posix) you want in the Preferences for best results.
- Kieran Huggins
- DevNet Master
- Posts: 3635
- Joined: Wed Dec 06, 2006 4:14 pm
- Location: Toronto, Canada
- Contact:
I had shswap installed back in my win2k days and I loved it in unnatural ways. Unfortunately, since upgrading to XP I've never been able to get it to work 
Instead I've used a decidedly less convenient vbs script which I can post if you're interested, and will try http://www.12noon.com when I get a chance.
Instead I've used a decidedly less convenient vbs script which I can post if you're interested, and will try http://www.12noon.com when I get a chance.
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I imagine if you had cygwin installed you'd be able to take comfort in a linux environment for things like this.
Code: Select all
for x in $(find /in/this/path -regex .*/matching/this/pattern)
do
#something involving mv command with full path $x
doneAnother freeware app:
http://www.beroux.com/english/softwares/renameit/
http://www.beroux.com/english/softwares/renameit/
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
The command is mv, not rename. mv means move. Move file foo to file bar. Or move file olddir/foo to newdir/fooThe Ninja Space Goat wrote:How come it tells me "rename: command not found" in cygwin? That seems like the perfect command... ?
EDIT | Lets say I wanted to change all .php files to .phps in my current working directory " . ".
Code: Select all
for x in $(find . -name '*.php')
do
mv $x ${x}s
doneisn't there a rename command though?
hmm... how would you use a part captured with parenthesis in the new name? I tried this:
it didn't work 
hmm... how would you use a part captured with parenthesis in the new name? I tried this:
Code: Select all
$ for x in $(find /cygdrive/c/htdocs/test -regex '/cygdrive/c/htdocs/test/([0-9
]+)[^\.]+\.txtt')
> do
> mv $x $1.txt
> done- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
Nope, mv is the rename command. There's no need for a rename command when mv does just that. Think of it this way. Moving a file from foo/bar to zip/bar isn't just "moving" a file. You renamed the full path, which results in the file being moved. The opposite is true. If you rename one.php to two.php you just moved it really. If you want a rename command, type this when you open cygwin:The Ninja Space Goat wrote:isn't there a rename command though?
Code: Select all
alias rename=mv