copycheck is a Linux command-line tool that allows the renaming a file
to include a copy identifier if a file with the same name already
exists in a specified directory. This can be useful to keep multiple
copies of a file in the same directory, but need to ensure that each
copy has a unique name.
- This tool doesn’t make filesystem changes, it only prints to the terminal.
copycheckonly works with files, not directories.- If the
--diroption is not specified,copycheckwill use the current directory as the target directory. - If the
--paddingoption is not specified,copycheckwill use a default value of 2 padding zeros for the copy identifier, e.g: ”01”. - If a file with the same name as the renamed file already exists,
copycheckwill increment the copy identifier and try again until a unique name is found.
copycheck, clone this repository and build the executable
using the Haskell’s cabal build system:
git clone https://codeberg.org/11xx/copycheck cd copycheck cabal install
This will build the executable and link it to Cabal’s default install
directory, that can be set by the CABAL_DIR environment variable; or
the location specified by installdir: in Cabal’s config file. This
directory can then be added to PATH to make the copycheck command
available globally.
copycheck, open a terminal and point it to the directory
containing the file to be renamed. Then, run the copycheck
command with the following options:
copycheck --file <filename> --text <copy-text> --dir <directory> --padding <num-padding-zeros>
--file: the path to the file to be renamed (required)--text: the string to be added to the file name to indicate it is a copy (optional, defaults to_COPY_)--dir: the directory where the file is located (optional, defaults to the current directory)--padding: the number of padding zeros to be added to the copy identifier (optional, default is2, producing a number such as “02”)
copycheck might be used to rename a file:
copycheck --file "report.txt" --text "_copy" --dir "documents" --padding 3
This will rename the file report.txt to documents/report_copy001.txt
if a file with that name already exists in the documents directory. If
a file with that name does not exist, the original file will not be
renamed.