[Klug-general] Bash script to delete folders if they exists

Stuart Brand stuart at stuartbrand.co.uk
Fri Jul 16 11:19:26 UTC 2010


What do you want this for? Be careful if you're dealing Cyrus mailbox folders... 

"Nathan Friend" <nathan.friend at gmail.com> wrote:

>Morning,
>I would like a simple bash script to check if a list of user directories
>exist and if they do delete them.  If they don't output a message and skip
>to next folder to check.  E.g.
>
>Does /Home/user1 exist > Yes > Delete /home/user1 goto next check
>                                       No  > "user1 not found" go to next
>check
>Does /Home/user2 exist > Yes > Delete home/user2 goto next check
>                                       No > "user2 not found" go to next
>check
>end.
>
>Any ideas how I can do this?
>
>Cheers,
>
>Nathan.
>_______________________________________________
>Kent mailing list
>Kent at mailman.lug.org.uk
>https://mailman.lug.org.uk/mailman/listinfo/kent
-- 
Sent from my Android phone with K-9 Mail. Please excuse my brevity.



More information about the Kent mailing list