Last active
November 4, 2016 22:35
-
-
Save DustinAlandzes/68255fe352f1e310f232259e06a4c0da to your computer and use it in GitHub Desktop.
This file contains 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 | |
# download with this command: | |
# curl -O https://gist.githubusercontent.com/f00-/68255fe352f1e310f232259e06a4c0da/raw/7ddd7a9d85ebb20c6b1e31cca993c791f21ec6f4/script4john.sh | |
# once you have it downloaded | |
# usage: ./script4john.sh folderYouAreChecking fileYouWantTokeep | |
# be careful, make sure you specify the right folder and file | |
# you could potentially rm -rf * somewhere important | |
# may need to give this file execution permissions, you can do this with chmod: | |
# chmod +x script4john.sh | |
#user arguments, $1 = folderYouAreChecking, $2 = fileYouWantToKeep | |
folder=$1 | |
file=$2 | |
#change directory to the folder specified | |
cd $folder | |
#copy the file we want to /tmp | |
cp $file /tmp/$file | |
#remove all the files | |
rm -rf * | |
#move the file we wanted back from /tmp to . (the current directory) | |
mv /tmp/$file . | |
echo success |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment