rm command

Hi,

I have test1 and test2 directories in /home/user/scripts. test1 and test2 contains the logs. i wanted to delete the logs files from these 2 directories using crontab.

i know how to delete the files from one directory.

30 18 * * * rm /home/user/scripts/test1/* <-- this will delete the files from test1. but test2 dir is also in the same location. how do i delete test2 files in the same crontab

i tried the following but no luck, can someone help me pls?
30 18 * * * rm /home/user/scripts/test1/; rm /home/user/scripts/test2/

thanks

30 18 * * * rm /home/user/scripts/test1/* && rm /home/user/scripts/test2/*
# OR
30 18 * * * rm /home/user/scripts/test[12]/*

vgersh99, Thank you very much.

just wondering for this entry:
30 18 * * * rm /home/user/scripts/test[12]/* <-- it has the files in test1 dir and test2 dir. But how this will fit

if i have dir logs instead of test1 and dir bk instead of test2

so 30 18 * * * rm /home/user/scripts/logs[bk]/* ?

thanks

no, not like that.
look into 'man sh' and look for 'File Name Patterns':
ls /home/user/scripts/@(logs|bk)/*

thank you again. when i try

rm /home/user/scripts/@(logs|bk)/* it says
Badly placed ()'s.