ANSWERED: Write a script to remove all the empty files in a given dir.

This commit is contained in:
Austin Songer 2020-01-21 21:48:34 +00:00
parent accce12933
commit 6c4f32af1b

View File

@ -4800,6 +4800,7 @@ Using the keyword <code>read</code> so for example <code>read x</code> will wait
<details> <details>
<summary>Write a script to determine whether a host is up or down</summary><br><b> <summary>Write a script to determine whether a host is up or down</summary><br><b>
**EXAMPLE ONE**
``` ```
#!/bin/bash #!/bin/bash
SERVERIP=<IP Address> SERVERIP=<IP Address>
@ -4817,6 +4818,21 @@ fi
<details> <details>
<summary>Write a script to remove all the empty files in a given directory (also nested directories)</summary><br><b> <summary>Write a script to remove all the empty files in a given directory (also nested directories)</summary><br><b>
**EXAMPLE ONE**
```
#! /bin/bash
for x in *
do
if [ -s $x ]
then
continue
else
rm -rf $x
fi
done
```
</b></details> </b></details>
<a name="shell-scripting-advanced"></a> <a name="shell-scripting-advanced"></a>