See, I new it would be simple in bash. Thanks for the effort Vince!you do not even really need a script, find and rm can do it just fine.
Code:find /home/user -size -1024k -maxdepth 1 -type f -exec rm {} \;
I bow to your skillz GnuVince...
See, I new it would be simple in bash. Thanks for the effort Vince!you do not even really need a script, find and rm can do it just fine.
Code:find /home/user -size -1024k -maxdepth 1 -type f -exec rm {} \;
You can't remember that command dude! Use the Python! ;D
See, I new it would be simple in bash. Thanks for the effort Vince!
If you made it a bash script, you wouldn't have to remember it.You can't remember that command dude! Use the Python! ;D
Would it be considered a script if it only had one command in it? You could write a BASH script to have it look and remove files with an interface to choose multiple sizes or last accessed time a such. Just an idea. And if the command is really hard to remember, alias it.
If you made it a bash script, you wouldn't have to remember it.
It would be considered a script if you put it in a file and made the file executable.Would it be considered a script if it only had one command in it?
That would work too, but sometimes you need to use the command from something that doesn't honor BASH aliases (like mutt), in which case you'd have to make it a script.And if the command is really hard to remember, alias it.![]()
Ok. How does this look?
#!/bin/bash/
#Interactive House Cleaning Script
echo " 1. Delete files from /home/users based on size"
echo " 2. Delete TMP files."
read answer
echo
case "$answer" in
1)
echo ""
echo "Let's clean house."
echo ""
echo -n "Enter the users name:"
read USER
echo -n "How large of files you wanting to delete? EXAMPLE, 1024 -"
read SIZEk
find /home/$USER -size -$SIZEk -maxdepth 1 -type f -exec rm {} \;
echo "DONE!"
clear
;;
2)
echo ""
echo "Let's clean house of the TMP files."
echo -n "Enter the users name:"
read USER
find /home/$USER -name "*.tmp" -maxdepth 1 -type f -exec rm {} \;
find /home/$USER -name "*.TMP" -maxdepth 1 -type f -exec rm {} \;
echo "DONE!"
;;
esac
Bookmarks