Exploring `czkawka-cli` Command with Examples
List Duplicate or Similar Files in Specific Directories
To use czkawka-cli
to list duplicate or similar files in specific directories, you can execute the following command:
czkawka-cli dup|image --directories path/to/directory1 path/to/directory2 ...
Motivation
The motivation behind using this command is to find duplicate or similar files within specified directories. This can be useful for organizing files, freeing up storage space, and identifying redundant data.
Explanation for Every Argument
dup|image
: This argument specifies whether the command should search for duplicate (dup
) or similar (image
) files. Choosedup
for exact duplicates andimage
for similar images.--directories
: This argument specifies the directories in which the command will search for duplicate or similar files. You can provide multiple directory paths separated by a space.
Example Output
Executing the following command will search for duplicate files within the Documents
and Pictures
directories:
czkawka-cli dup --directories /home/user/Documents /home/user/Pictures
The output will provide a list of duplicate files found within the specified directories. For each duplicate group, the command will list the file paths, sizes, and hash values.
Find Duplicate Files in Specific Directories and Delete Them
To find duplicate files in specific directories and delete them, you can use the czkawka-cli
command with the following syntax:
czkawka-cli dup --directories path/to/directory1 path/to/directory2 ... --delete-method AEN|AEO|ON|OO|HARD|NONE
Motivation
The motivation behind using this command is to not only identify duplicate files but also automatically delete them. This can be useful to save storage space and remove unnecessary duplicates.
Explanation for Every Argument
--directories
: This argument specifies the directories in which the command will search for duplicate files. Provide the paths of the directories you want to scan.--delete-method
: This argument defines the method used for deleting duplicate files. The available options are:AEN
: Delete all files except the newest one in each duplicate group.AEO
: Delete all files except the oldest one in each duplicate group.ON
: Deletes all files except the files with the original extension.OO
: Deletes all files except the files with the original origin.HARD
: Deletes all files that are hard-linked except one copy.NONE
: Do not delete any duplicate files.
Example Output
For instance, running the following command will search for duplicate files within the Downloads
directory and delete all except the newest files in each duplicate group:
czkawka-cli dup --directories /home/user/Downloads --delete-method AEN
The output will display the list of duplicate files found and provide information about the deleted files in each group.
Conclusion
In this article, we explored various use cases of the czkawka-cli
command. We learned how to list duplicate or similar files in specific directories and how to find duplicate files in specific directories and delete them using different deletion methods. These examples demonstrate the versatility of the czkawka-cli
command-line tool in helping you manage and optimize your files and directories effectively.