renumberfile(NAME, P) renumbers the files matching NAME having an index
following the substring P, using consecutive indices starting from 1.
Wildcards (*) and brackets (see rdir) may be used in NAME. If P is
present several times in a filename, uses only the last occurrence.
renumberfile works only in the current directory (NAME cannot contain
pathnames).
renumberfile(NAME, P, NEWNUM) does the same, using NEWNUM to renumber
the files. If NEWNUM is a number, uses consecutive indices starting
from NEWNUM. If NEWNUM is an array, uses it to renumber the files. By
default, NEWNUM=1.
renumberfile(NAME, P, NEWNUM, NZ) specifies the number of 0 pading the
index (e.g., '302' paded with 5 zeros is '00302'). By default, NZ=5.
renumberfile(NAME, P, NEWNUM, NZ, OPT), where OPT is 'dironly',
'fileonly' or 'filedir', renumbers only the directory names, the file
names, or both (by default), respectively.
Examples
If renumberfile('DSC*.JPG','DSC') is used in a directory that
contains 100 JPG-files with arbitrary file numbers, the files are
renumbered as 'DSC00001.JPG'...'DSC00100.JPG'.
renumberfile('DSC*.JPG','DSC',401) does the same, renumbering
the files as 'DSC00401.JPG'...'DSC00500.JPG'.
renumberfile('DSC*.JPG','DSC',1,3) does the same, renumbering
the files as 'DSC001.JPG'...'DSC100.JPG'.
See Also
getfilenum, rdir, renamefile.