.\" ======================== .\" ===== =============== .\" ====== ================ .\" ====== ================ .\" ====== ==== ==== == .\" ====== === == = = .\" ====== === = == = .\" = === === = == ==== .\" = === === = == = = .\" == ===== ==== == .\" ======================== .\" .\" SPDX-License-Identifier: BSD-3-Clause .\" .\" Copyright (c) 2020 Joe .\" All rights reserved. .\" .\" Redistribution and use in source and binary forms, with or without .\" modification, are permitted provided that the following conditions are met: .\" 1. Redistributions of source code must retain the above copyright .\" notice, this list of conditions and the following disclaimer. .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. .\" 3. Neither the name of the organization nor the .\" names of its contributors may be used to endorse or promote products .\" derived from this software without specific prior written permission. .\" .\" THIS SOFTWARE IS PROVIDED BY JOE ''AS IS'' AND ANY .\" EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED .\" WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE .\" DISCLAIMED. IN NO EVENT SHALL JOE BE LIABLE FOR ANY .\" DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES .\" (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; .\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" .\" unixize: man/unixize.1 .\" Sun Nov 29 17:59:38 CET 2020 .\" Joe .\" .\" Manpage for unixize. .\" Contact rbousset@42lyon.fr to correct errors and typos. .\" .de Text .nop \)\\$* .. .de squoted_text .Text \\$3\(oq\fB\\$1\f[]\(cq\\$2 .. .de dquoted_text .Text \\$3\(lq\fB\\$1\f[]\(rq\\$2 .. .de file_example .PP .RS \`\\$1\' \-\> \`\\$2\' .RE .PP .. . . .TH unixize 1 "29 November 2020" "unixize 1.0" . . .SH NAME .B unixize \- bulk rename directory contents . . .SH SYNOPSIS .SY unixize .RB [ \-ahiknprRv ] [\c .BI \-e ext\c ] .I directory .YS . . .SH DESCRIPTION .PP The .B unixize utility renames all file in a given .I directory to a predefined style. Here is a description of the .B unixize behaviour without options. This behavious can be changed using options, see \(lqOPTIONS\(rq below. By default: . .PP . All upper-case characters will be set to lower-case. . .file_example "FILE" "file" . Spaces will be substitued by a .BR separator , by default underscores .squoted_text _ ). ( . .file_example "a file with spaces.org" "a_file_with_spaces.org" . Multiple spaces will be condensed into only one .BR separator . . .file_example "lots of spaces.gif" "lots_of_spaces.gif" . By default the .BR "opposite separator" is hyphen .squoted_text - ). ( All .BR "opposite separator" will be changed to the chosen .BR separator , underscores .squoted_text _ ) ( by default. . .file_example "2004-with-the-lights-out" "2004_with_the_lights_out" . All unicode characters will be deleted except for latin extended ascii characters, which will be replaced by the most relevant ascii character (or double characters). . .file_example "\(EuHliðskjálf\(de\(dd.jpg" "hlidhskjalf.jpg" . Two special patterns are always substitued, regardless of options. .PP The first sequence is .dquoted_text C\+\+ , which will always be changed to .dquoted_text cxx whether the letter .squoted_text C is upper-case or lower-case. . .file_example "learn_c++_programming.pdf" "learn_cxx_programming.pdf" . The second one is the special case where the filename begins with a number, followed directly by a dot .squoted_text . ) ( and another dot .squoted_text . ) ( can be found later in the filename (for example the file's extension). In this case, the first dot is removed. . .file_example "07. Negative Creep.flac" "07_negative_creep.flac" . If another dot .squoted_text . ) ( can't be found, nothing is changed. . .file_example "255.sql" "255.sql" . In the case where the renamed version of a file is already present in the .I directory (for example if \(lqREADME\(rq is being unixized but another \(lqreadme\(rq already exists), or if the renamed version is empty of text, the renaming of this file will be skipped. .SH OPTIONS .TP .B \-a Include directory entries whose names begin with a dot .squoted_text . ). ( .TP .BI \-e\c ext Unixize certain file extensions. .I ext can be either .IR 0 , .I 1 or .IR 2 . Some file extensions are often prefered over other ones to specify the same file type in UNIX-like operating systems. With .I ext set to .IR 1 , .dquoted_text .asm extensions will be changed to .dquoted_text .S , .dquoted_text .cpp extensions will be changed to .dquoted_text .cc , .dquoted_text .hpp extensions will be changed to .dquoted_text .hh and .dquoted_text .txt files will see their extension removed. When .I ext is set to .IR 2 , all the previous rules are applied as well except that .dquoted_text .cpp extensions will be changed to .dquoted_text .cxx and .dquoted_text .hpp extensions will be changed to .dquoted_text .hxx . Default: .IR 0 . q.TP .B \-h Output a brief help message. .TP .B \-i Prompt user before running .B unixize on the specified directory. If the .B \-R option is being used, the user will be prompted for each subdirectory the program is entering. .TP .B \-k Keep the opposite separator occurences in the filename. If the .B \-n option is not being used, all existing hyphens .squoted_text - ) ( will be preserved. Otherwise, all existing underscores .squoted_text _ ) ( will be kept. .RS 12 \`screen 2020-10-21.mkv\' \-\> \`screen_2020-10-21.mkv\' .RE .TP .B \-n Use hyphens .squoted_text - ) ( instead of underscores .squoted_text _ ) ( as a .B separator and sets underscores as the .BR "opposite separator" . .RS 12 \`04 School.mp3' \-\> \`04-school.mp3\' .RE .RS 12 \`11-27_958x1078_scrot.png\' \-\> \`11-27-958x1078-scrot.png\' .RE .TP .B \-p Pretend only. .B unixize will run normally but will not actually rename any file. This option is intended to be used with the .B \-v and/or .B \-r options. .TP .B \-R Recursive mode. The program will enter and repeat into every subdirectories. .TP .B \-r Reverse verbose mode. Files that are not being renamed will be displayed to stdout. .TP .B \-v Verbose mode. File that are being renamed will be displayed to to stdout as well as their new version. . .SH BUG REPORT Please note that .B unixize was tested only on FreeBSD at the moment. Linux and macOS tests are coming soon. You can report bug at .I rbousset@42lyon.fr or on GitHub at .I https://github.com/JozanLeClerc/unixize/issues or on Chisel .IR https://chiselapp.com/user/JozanLeClerc/repository/unixize/ticket . . .SH AUTHORS Joe .SH SEE ALSO .IR ascii (7), .IR ls (1), .IR tree (1), .IR rename (2) .\" vim: set filetype=groff: