Home > OS >  Linux script
Linux script

Time:11-18

Write a script that will be a directory in the file into two categories, namely the empty file and is not empty, all the empty file name and not empty all files are saved to the name of the two text files (the names of two text files can be set by yourself), finally delete all empty files in this directory,

CodePudding user response:

If the [[! - s filename]] file exists and is empty,

CodePudding user response:

reference 1st floor mouse_zhu response:
if the [[! - s filename]] file exists and is empty,
can't complete

CodePudding user response:

 
#!/bin/bash

For I in $(ls/TMP); Do
If the [[! - s $I]]. Then
Echo $I
Cp - rf $I/empty_dir
# rm - rf $I
Fi
Cp - rf $I/no_empty_dir
The done

CodePudding user response:

refer to the second floor qq_45897252 response:
Quote: refer to 1st floor mouse_zhu response:
if the [[! - s filename]] file exists and is empty,
can complete a bit

Why don't you

CodePudding user response:

I don't understand???????? To do
  • Related