Created
November 2, 2016 10:04
-
-
Save ShapeShifter499/1ec06e2e85653aa3c2a9595a7ab2a8b2 to your computer and use it in GitHub Desktop.
This script should remove symlinks that link outside of the directory then leave a dummy file behind.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
find /run/media/raansu/2b165e4f-8bbe-4fe1-81dd-653be4df6859/decrypted -type l -print | \ | |
while read symlink | |
do | |
target=$(readlink -f "$symlink") | |
expr match "$target" "^/run/media/raansu/2b165e4f-8bbe-4fe1-81dd-653be4df6859/decrypted/.*" >/dev/null || echo "$symlink" | |
rm "$symlink" | |
touch "$symlink".symlink-rm | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment