Create a Post
cancel
Showing results for 
Search instead for 
Did you mean: 
yosefgher
Explorer
Jump to solution

script to delete files

I received script from TAC to delete temp files from the tmp directory , but the script runs forever and it does not delete the files .

I am not sure if the script is correct .Can anyone check this script if it is correct?

It looks the rm-f $file is in echo

 

 for file in *; do file_size=$(du $file | awk '{print $1}'); if [ $file_size == 0 ]; then echo "Deleting empty file $file with file size $file_size!"; echo "rm -f $file"; fi;done

0 Kudos
1 Solution

Accepted Solutions
Sorin_Gogean
Advisor

hey,

 

Script is fine (but is incomplete, there is missing a part from the beginning), it's just returning what you need to remove - there the echo.

Not sure if that is the purpose, and you should go over the RM lines and see if you are OK to remove those files or not.

 

Thank you,

View solution in original post

0 Kudos
4 Replies
G_W_Albrecht
Legend Legend
Legend

If you got it from TAC, please contact them again 😎

CCSP - CCSE / CCTE / CTPS / CCME / CCSM Elite / SMB Specialist
0 Kudos
yosefgher
Explorer

I tried to contact TAC, they  do not respond.

Just want to check if the  script is correct

0 Kudos
Sorin_Gogean
Advisor

hey,

 

Script is fine (but is incomplete, there is missing a part from the beginning), it's just returning what you need to remove - there the echo.

Not sure if that is the purpose, and you should go over the RM lines and see if you are OK to remove those files or not.

 

Thank you,

0 Kudos
yosefgher
Explorer

Thank you Sorin,

That is what i suspected.

 

0 Kudos

Leaderboard

Epsum factorial non deposit quid pro quo hic escorol.

Upcoming Events

    CheckMates Events