Files containing different symlinks may still be reported as identical. So two folders which contain identical files, or no files, but have different empty folders inside them, will still be reported as identical. Does not detect differences in file timestamps, ownership or permissions.Inefficient: it md5sums files deep in the tree multiple times (once per ancestor folder).# Display only the lines with duplicate hashes (first 32 chars are duplicates) # Hash that list of hashes, discard the newline character, Save the following script as seek_duplicate_folders.sh and then run it like this: $ bash seek_duplicate_folders.sh So any folder containing identical files in the same structure should produce the same hash!Īt the end, we use uniq to display only the duplicate folder hashes. I want to share this way because I think it is quite fun.įor each subfolder below the target folder, we generate a hash for that subfolder.Įach folder hash is generated from the result of hashing all the files below that folder. Here is a direct link to the English guide. It may save you the effort of having to write and debug a script. There a re a lot of powerful features in this simple little tool. There is also an Advanced search parameters tab at the top of the FSlint window that allows you to exclude certain directories in your search, or filter your results using parameters. I have found Name clashes to be useful where there are files that have the same name, but are different (perhaps because you saved a newer version of a file in a different directory). ![]() You would use this feature if you wanted to keep your existing file structure, but wanted to free up some space on your system.įSlint has other powerful features which are accessible from the tabs in the left pane. Note that the Merge feature removes the unselected files from your system and creates hard links to the corresponding selected files. If you need to use the list of selected files outside of FSlint (perhaps as input to your own script) click on the Save button to save a text file.įinally you can delete the selected files using the Delete button, or you can merge the selected files using the Merge button. If you want to select multiple files automatically, click on the Select button and you will be given options such as selecting files based on date, or entering wild card selection criteria. Now you can select multiple files using the Shift or Ctrl keys and left mouse button. FSlint also presents you with the number of bytes wasted due to the redundant files. (Any errors, such as file permission issues, will be printed at the bottom of the FSlint window).įSlint will list all of the duplicate files, their directory locations, and the file date. Make sure the recurse? check-box at the the right is selected. Obviously, you can remove directories using the Remove button. There are many advanced features, but basic usage of the application is relatively straightforward.Ĭlick the Add button at the top left to add all the directories you would like to check. Here is a screen-shot of the main screen. You can remove FSlint using the Software Center or by typing sudo apt-get autoremove -purge fslint in a terminal). Specifically, fslint depends on findutils, python, and python-glade2, which should all be on your system already. (On my system, installing FSlint did not pull in additional dependencies. Install FSlint from the Ubuntu Software Center, or from the command line as follows: sudo apt-get install fslint ![]() thenįSlint is a small GUI application that helps you identify and clean your system of redundant files. ![]() To do this replace the loop above with: while IFS= read -r -d $'\0' filename In other words, if the first directory contains a file a/b/c/some.txt, we will consider it present in the second directory if file some.txt exists in any subdirectory of the second directory. Suppose that we match files by name but regardless of directory. ![]() This just removes from filename the prefix containing directory $1. So, in place of the call to basename, the line fn=$ is used. done < <(find "$1" -type f -print0) is safe against all file names.īasename is no longer used because we are looking at files within subdirectories and we need to keep the subdirectories. The construction while IFS= read -r -d $'\0' filename do. This uses find to recursively dive into directory $1 and find file names. The key loop now reads: while IFS= read -r -d $'\0' filename Without the double-quotes, directory names with spaces or other difficult characters would cause errors. Note that I have added double-quotes around $1 and $2 at various places above to protect them shell expansion. # Process each file in directory_1, comparing it to directory_2 # Make sure both arguments are directories # cmp_dir - program to compare two directoriesĮcho "usage: $0 directory_1 directory_2" 1>&2
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |