This script makes the metadata of all files in the execution directory unknown. It changes the owner to "nobody" and sets the creation date as well as the modification date to 01.01.2001 12:00.
Last active
August 22, 2019 16:24
-
-
Save Skn0tt/ffa32b35a0e725d4e6f6488e06ea8e09 to your computer and use it in GitHub Desktop.
Anonymise a folder
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 | |
echo "Are you sure you want to anonymise this directory?" | |
select yn in "Yes" "No"; do | |
case $yn in | |
Yes ) | |
shopt -s dotglob | |
for f in * **/* ; do | |
sudo chown nobody "$f" | |
sudo touch -t 200001011200 "$f" | |
done; | |
shopt -u dotglob | |
exit;; | |
No ) exit;; | |
esac | |
done |
Thanks a lot for the compliment, I appreciate it!
Didn't know about quoting variables, but that makes perfect sense. Thanks a lot for bringing it up. I updated the Gist accordingly.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, I found your website and came to say, keep up the great work! And a little note, always quote variables in sh/bash, as in
"$f"
. Otherwise they will be split at whitespace (before i.e.chown
can see them) and even undergo glob expansion and possibly other things happen.