Donnerstag, 25. Dezember 2014

Find duplicates in a folder and convert them to symlinks ubuntu 14.04

Hi,
Duplicate files waste precious space on your computer’s hard drive.
Here a terminal approach with a script to vonvert them to symlinks:

first install the dependencies:

Code:
sudo apt-get install rdfind symlinks

Now create the blxremoveduplicates script:
Code:
#!/bin/bash
if [[ -d "$1" && ! -L "$1" ]] ; then
    rdfind -makesymlinks true $1
    symlinks -crs $1
else
echo "Enter a valid directory name!"
fi

USAGE : ./blxremoveduplicates folder_name

You can "compile" it with shc and place it in the /usr/bin folder after that.
if you know that your directory contains broken symlinks use this script instead:

Code:
#!/bin/bash
if [[ -d "$1" && ! -L "$1" ]] ; then
     find -L $1 -type l -delete
     rdfind -makesymlinks true $1
     symlinks -crs $1
else
echo "Enter a valid directory name!"
fi


Another method:
Code:
There are still good, mature applications for finding and removing duplicate files on Linux. FSlint offers a good graphical interface and should be available in most Linux distributions’ software repositories. You won’t find the shiniest interfaces, but you will find simple, functional software that doesn’t want to push junkware on you or sell you anything.
source: http://www.howtogeek.com/201167/how-to-find-and-remove-duplicate-files-on-any-operating-system/

You can install this with:
Code:
sudo apt-get install fslint
start it with: fslint-gui

Fslint is a bit easier to use but i do see that it fails very often and the method is nor so stable as my command line approach, but perhaps you`ll like fslint more, so i posted it here too.

Hope this tutorial it helped someone.

Keine Kommentare:

Kommentar veröffentlichen