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 expandstr) 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 padding the
index (eg, '302' padded with 5 zeros is '00302'). By default, NZ=5.
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'.
F. Moisy
Revision: 1.12, Date: 2005/10/21.
See Also
getfilenum, expandstr, rdir, renamefile.