devops-exercises/topics/shell/solutions/empty_files.md
abregman 99c4e02ecf Rename exercises dir
Name it instead "topics" so it won't be
strange if some topics included "exercises" directory.
2022-08-02 01:53:56 +03:00

264 B

Empty Files

Objectives

  1. Write a script to remove all the empty files in a given directory (including nested directories)

Solution

#! /bin/bash
for x in *
do
    if [ -s $x ]
    then
        continue
    else
        rm -rf $x
    fi
done