chsuf − changes the suffix of files |
chsuf [ OPTION ]... --append=suffix file ... chsuf [ OPTION ]... --delete[=suffix] file ... chsuf [ OPTION ]... [ --from=oldsuffix ] --to=newsuffix file ... chsuf [ --version ] |
chsuf changes the suffix of files and/or directories. It also can be used to add or remove a suffix to/from a list of files. chsuf might be useful to change DOS-style three character extensions to more readable variations (eg htm to html), or to add an extension to filenames for later use on platforms which depend on them. |
--append=suffix |
Add the suffix given by --append to the name of all given files. --from, --to and --delete will be ignored when this option is used. |
--delete[ =suffix ] |
Delete the specified suffix from the name of all given files. When no suffix is, the shortest arbitrary suffix (if any) will be deleted. |
−i, −−interactive |
Prompt whether or not to overwrite existing regular destination files. |
−r, −−recursive |
Recursively enter directories to change suffixes. |
−d, −−rename-dirs |
Modify directory names as well as file names. |
−v, −−verbose |
Be verbose and print every filename changed. |
−V, −−version |
Show the release version of chsuf. All other options will be ignored. |
--from=oldsuffix |
In conjuction with --to specifies the suffix to be changed, omitting period. Files with other suffixes will not be renamed. When --append or --delete is used this will be ignored. |
--to=newsuffix |
This is the suffix to change to, omitting the period. When no suffix is given by using --from, the shortest arbitrary suffix (if any) will be changed. When --append or --delete is used this will be ignored. |
You may have some HTML-files from different sources; some ending .htm, some ending .html. As a GNU/Linux/Unix (whatever) user you want to only use .html so you can type: chsuf --from="htm" --to="html" * If you also want to change the files in subdirectories, you would use: chsuf -r --from="htm" --to="html" * Finally, if you would like to be told what’s being done add −v or --verbose: chsuf -rv --from="htm" --to="html" * Let’s say you want to export a bunch of text files to a system which expects the names of textfiles to end with .txt. To do this you can use: chsuf -v --append="txt" texts/* In case you have files from a lousy system which requires such extensions and you want to get rid of the annoying .txt suffixes you will type: chsuf -v --delete="txt" texts/* if you want to remove all the suffixes of all the files in the directory and all sub-directories use: chsuf -v --rename-dirs --recursive --delete * or, for short: chsuf -vdr --delete * |
Many, for sure! This is still a beta, you know... |
A more general tool using regexps to rename files would be much more powerful but also much harder to use. |
mv(1), cp(1) |
Sascha Wilde <swilde@users.sourceforge.net>, Daniel Roberge <droberge@users.sourceforge.net> |
To Phil Williams <phil@subbacultcha.demon.co.uk> for beta-testing, ideas and suggestions. |