Skip to content

Instantly share code, notes, and snippets.

Created April 15, 2017 15:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f42dcffbc5a64174d1f19ca664d8f92b to your computer and use it in GitHub Desktop.
Save anonymous/f42dcffbc5a64174d1f19ca664d8f92b to your computer and use it in GitHub Desktop.
hardlinks duplicates in steam directories, is very careful not to link too much
#!/bin/bash
set -x
function hlink {
set -x
name="$2"/$(echo $1 | grep -oPe '(?<=/steamapps/).*$')
if test -f "$name"; then
rdfind -makeresultsfile false -makehardlinks true "$1" "$name"
fi
}
export -f hlink
a=$(echo "$1" | sed 's/\/$//')
b=$(echo "$2" | sed 's/\/$//')
find "$a"/steamapps -type f -exec bash -c "hlink '{}' $b/steamapps" \;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment