Results 1 to 3 of 3
I was asked to make a program in Linux(Ubuntu) that removes all empty files in the current directory. I've got an idea on how to do it, but for some ...
- 11-23-2010 #1Just Joined!
- Join Date
- Nov 2010
- Posts
- 1
Help with Linux Script!
I was asked to make a program in Linux(Ubuntu) that removes all empty files in the current directory. I've got an idea on how to do it, but for some reason it's not working as I planned,since the brackets from the if statements are giving me an error.

[: 6: find: unexpected operator
This is my program:
#!/bin/bash
if [ find . -type f -size 0 ]
then
find . -type f -size 0 | xargs rm -r
echo "The empty files have been deleted"
else
echo "There are no empty files in this directory
fi
I really need this done ASAP
Pls
Last edited by eltiti55555; 11-23-2010 at 10:50 PM.
- 11-23-2010 #2
- 11-24-2010 #3
Hello and Welcome.
Were you asked by a teacher? This smells of homework to me and that is forbidden. I'll be keeping an eye on this thread.
I do not respond to private messages asking for Linux help, Please keep it on the forums only.
All new users please read this.** Forum FAQS. ** Adopt an unanswered post.


Reply With Quote
