Troz Troz - 1 year ago 79
Linux Question

Loop through users folders and delete a folder

How can I loop through the

directory for each user and delete a folder? It will be a common one called

Answer Source

Like this:

#Get the list of users
USERS=`ls -l /home|grep "^d"|awk '{print $NF}'`
#Loop for each user and delete the files
for i in $USERS
  rm -rf /home/$i/.quarentine
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download