Logo 
Search:

Unix / Linux / Ubuntu Articles

Submit Article
Home » Articles » Unix / Linux / Ubuntu » Homework HelpRSS Feeds

write a script to delete zero sized files from a given directory (and all its subdirectories)

Posted By: Bingham Fischer     Category: Unix / Linux / Ubuntu     Views: 6075

write a script to delete zero sized files from a given directory (and all its subdirectories)

Code for write a script to delete zero sized files from a given directory (and all its subdirectories) in Unix / Linux / Ubuntu

for file in *
doif [-f $file -a ! -S $file ]; then 
    echo  "Delete $file [y/n] \c"
    read ans
    while [ans -eq ""]
    do
    read ans
    done
    if[$ans = y -o $ans = Y]
    then
    rm  -f $file
    echo "$file Deleted "
    fi
done
  
Share: 



Bingham Fischer
Bingham Fischer author of write a script to delete zero sized files from a given directory (and all its subdirectories) is from Frankfurt, Germany.
 
View All Articles

Related Articles and Code:


 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!