help renfiles
-------------------------------------------------------------------------------

Title

renfiles -- Renaming matched files by replacing specified sign/substring with a > nother sign/substring.

Syntax

renfiles [, folder(string) match(string) insign(string) outsign(string) erase]

Description

renfiles is a program that helps to rename files in a quite generally applicable fashion - changes applied to all matched filenames in a stated directory. The simplest syntax is purely based on defaults. All options are optional.

If the sign to-be-replaced is a dot, the last dot is not changed (keeping file-suffix).

Options

folder(string) Defines the directory from within where to look for files. The default directory is the current working directory (cwd; '.').

match(string) Defines the matching criterion used in order to select files from the selected directory folder. The default is all files in the directory ('*').

insign(string) The sign to be replaced when applying the used criterion match with respect to the files in the directory folder. Is case-sensitive. The default is the dot sign ('.').

outsign(string) The sign to be replacing (the to-be-replaced sign insign) when applying the used criterion match with respect to the files in the directory folder. To remove the sign insign, i.e. replacing it with an empty space, use string null. The default is the underscore sign ('_').

erase An indicator for whether, or not, the original matched (but unchanged) files should be removed from the directory.

Examples

--------------------------------------------------------------------------- 1. Remove dots from all files in current working directory and replace them with underscores. . renfiles

--------------------------------------------------------------------------- 2. Remove dots from all files with prefix name located in cwd-subdirectory data and replace them with dashes. . renfiles , folder(".\data") match("name*") outsign("-")

--------------------------------------------------------------------------- 3. Same as Example 2, but in this case all matched, original, files are also to be erased. . renfiles , folder(".\data") match("name*") outsign("-") erase

---------------------------------------------------------------------------

4. Remove all occurrences of file and replace them with abbreviation f in all files with filenames including string-part proj3 located in cwd-subdirectory results. . renfiles , folder(".\results") match("*proj3*") insign("file") outsign("f")

---------------------------------------------------------------------------

5. Same as Example 4, but in this case all Denmark-specific letters ('å', 'æ' and 'ø') are removed in a sequential manner; original/temporary files are erased. . renfiles , folder(".\results") match("*proj3*") insign("å") outsign("aa") erase . renfiles , folder(".\results") match("*proj3*") insign("æ") outsign("ae") erase . renfiles , folder(".\results") match("*proj3*") insign("ø") outsign("oe") erase

---------------------------------------------------------------------------

6. Same as Example 4, but in this case all present empty spaces, within matched filenames, are removed (replaced with null space; see note above). . renfiles , folder(".\results") match("*proj3*") insign(" ") outsign("null")

---------------------------------------------------------------------------

Author

Lars Ängquist la@ipm.regionh.dk lars.angquist@telia.com

Also see

Help: [help pages on] extended_fcn, dir, erase