RN(1)			    Easy multiple renaming			 RN(1)



NAME
       rn rename multiple files, directories or extensions

SYNOPSIS
       rn option [--dir | --ext] [-q] target

DESCRIPTION
       rn  transforms  the names of any number of target files, directories or
       extensions according to the given options and their parameters.

OPTIONS
       -d <:n | -n | n:m | n:>
	      Delete the first n characters of the target names if n is a pos-
	      itive  number  preceded by a colon, delete the last n characters
	      if n is a negative number, delete all characters	from  the  nth
	      position to the mth position when n and m are both positive num-
	      bers separated by a colon, and delete from the nth character  to
	      the end of the target names when a positive number n is followed
	      by a colon.

	      Character positions are counted from one, so n  must  be	a  non
	      zero positive number.

	      In the first option (:n), the colon can be omitted.

       -x <text | text: | :text | text1:text2>

	      Delete  all  the appearances of text in the target names for any
	      given text, delete from text to the end of the target names when
	      text  is	followed  by a colon, delete from the beginning of the
	      target names to text when text  is  preceded  by	a  colon,  and
	      delete from text1 to text2 when text1 and text2 are separated by
	      a colon.

       -r old new
	      Replace all the appearances of old in the target names with new.

       -u     Change all the target names to upper case.

       -l     Change all the target names to lower case.

       -t     Change  all  the	target names to title case (all words starting
	      with an upper case letter).

       -p prefix
	      Add prefix at the beginning of the target names.

       -s suffix
	      Add suffix at the end of the target names.

       -h     Help. Show a short summary of options.

       --dir  Rename directories.

       --ext  Rename extensions.

       -q     Quiet option. Will not show the new names and will not  not  ask
	      for  confirmation  before renaming. Error messages will still be
	      shown, though.

       target The names or paths of the files or directories  to  rename.  For
	      file  extensions,  the  names or paths of the files whose exten-
	      sions will be renamed.

	      As default, rn will rename files. To rename directories or  file
	      extensions  use  the  option --dir or --ext, repectively, before
	      target.

	      All the wild-cards admitted by the shell, like "*" or  "?",  are
	      allowed.

EXAMPLES
       Delete  the  last  two  characters of all the file names in the current
       directory:

	      $ rn -d -2 *

       Delete all whitespace characters from all the file names in the current
       directory:

	      $ rn -x ' ' *

       Delete the word "HDTV" from all the file names with "mpg" extension  in
       the current directory:

	      $ rn -x HDTV *.mpg

       Delete  all the text from "season-" to the end of the file name for all
       the files in the directories ~/flying-circus-1 and ~/flying-circus-2:

	      $ rn -x season-: ~/flying-circus-1/* ~/flying-circus-2/*

       Replace whitespace characters with hyphens in all the file names  found
       in  the	subdirectories	below the current directory. Note that rn will
       replace each space with a hyphen, e.g. "one two	" -> "one-two--".

	      $ rn -r ' ' - */*

       Change all the "JPG" extensions to lower case for all the files in  the
       current directory:

	      $ rn -l --ext *.JPG

       Add  the  prefix  "monty-python-"  to  the  names  of three directories
       (grail, brian and life):

	      $ rn -p "monty-python-" --dir grail brian life

RECURSIVITY
       There is no specific option to recursively rename files through	subdi-
       rectories, but it can still be achieved in two ways:

       - specifying all the paths:
	      $ rn -l --ext *.JPG */*.JPG */*/*.JPG */*/*/*.JPG

       - combining the find command (in UNIX like systems) with rn:
	      $ find . -name *.JPG -exec rn -l --ext -q {} ;

ERROR MESSAGES AND WARNINGS
       Not matching target!
	      No  file or directory found with that name. Check syntax and for
	      extra "options" that should not be there that rn could interpret
	      as file names.

       Wrong arguments for delete!
	      The delete option (-d) admits only one argument. If you are try-
	      ing to specify a range like  n:m,  do  not  let  any  whitespace
	      before  or after the colon. Use crop(-x) to delete characters or
	      words.

       Wrong arguments for crop!
	      Crop (-x) admits only one argument. A text that may be  preceded
	      or followed by a colon without any whitespace between them.

       Wrong arguments for replace!
	      Replace admits only two arguments: the old text and the new text
	      with one whitespace between them.

       Wrong arguments!
	      Generic error for the rest of options. Check usage.

       No changes!
	      No file was renamed because the rename option  selected  had  no
	      effect  in the target names, i.e. trying to change to lower case
	      files that are lower case.

       Repeated name(s)!
	      No file was renamed because, as a result of the renaming	opera-
	      tion,  some  of the selected files would have had the same name,
	      or would have had the same name of an already existant  file  or
	      directory.

       Aborted by user!
	      No  renaming occurred because you answered "no" to the confirma-
	      tion question.

       I/O error! Check permissions.
	      A real input/output error occurred in the system or, more proba-
	      bly,  you  do  not  have permission to rename all or part of the
	      target files.  No file was renamed (not even the	ones  you  had
	      permission to, if any).

BUGS
       Unaware of them in version 1.0.

       If  you find an error, either in the program, or in this manual, please
       e-mail the details to the author. Hopefully it will be  solved  in  the
       next version of rn.

AUTHOR
       Jose M. Casarejos <rn-program at mundo-r dot com>



v1.0				  2015-09-24				 RN(1)
