# Why isn't "rename" in the base installation?



## nickednamed (Nov 14, 2012)

I'm not trying to tell anyone what should or shouldn't be in the base system, but when I type "man rename" I get the manual for the rename program, desipte the fact it is not installed.

So just wondering, if it is not installed, why do I have the manual page?

And how do other people batch rename their files? mv?


----------



## graudeejs (Nov 14, 2012)

nickednamed said:
			
		

> I'm not trying to tell anyone what should or shouldn't be in the base system, but when I type "man rename" I get the manual for the rename program, desipte the fact it is not installed.
> 
> So just wondering, if it is not installed, why do I have the manual page?
> 
> And how do other people batch rename their files? mv?



check the title of rename(2)


> FreeBSD System Calls Manual



what you are looking for is mv(1)

For batch renaming there are probably some scripts or programs in ports, but I haven't need for that. Usually I simply write my own sh script


----------



## SirDice (Nov 14, 2012)

Batch renaming is a bit tricky, be very, very careful with using wildcards with the *mv* command!

I regularly download stuff and I sometimes get names like:

```
Series_1of3.avi
Series_2of3.avi
Series_3of3.avi
```

x11-fm/thunar is quite helpful if you enable PLUG_SBR_PCRE. The Bulk Rename tool can then use pcre so it's easy to transform them into this in just one go.

```
Series_1x01.avi
Series_1x02.avi
Series_1x03.avi
```

A simple "(\d+)of\d+" to "1x0$1" renames the lot if you select them all and choose "rename".


----------



## nickednamed (Nov 14, 2012)

Thanks for clearing that up.

I'm currently using sysutils/rename because:

I've been unlucky [stupid] with "mv" before.
My scripting skills are virtually non-existent.
I like fast, light, CLI apps.

So far, so good  I haven't lost anything yet and I'm getting a chance to practice my regular expressions.


----------



## UNIXgod (Nov 14, 2012)

nickednamed said:
			
		

> I'm not trying to tell anyone what should or shouldn't be in the base system, but when I type "man rename" I get the manual for the rename program, desipte the fact it is not installed.
> 
> So just wondering, if it is not installed, why do I have the manual page?
> 
> And how do other people batch rename their files? mv?



Okay I see. There is a third party port which bares the same name as the c library function.

According the man page:

```
STANDARDS
     The rename() system call is expected to conform to ISO/IEC 9945-1:1996
     (``POSIX.1'').  The renameat() system call follows The Open Group
     Extended API Set 2 specification.
```
It's in base because it's part of the posix c standard and FreeBSD is a posix compatible system. The third party port on the other hand is not so it is not in base.

I use mv(1). It's usually part of a larger script as graudeejs suggested in contrast to a one-liner.


----------



## neowolf (Nov 15, 2012)

I'm quite fond of misc/mmv myself for mass renaming. It's wild card support is fairly intuitive to me and it does the job.


----------

