Remove Files of given range in bash/shell/unix -
i have files of below name format.
test_1_452161_987654321.arc test_1_452162_987654321.arc test_1_452163_987654321.arc . . . test_1_452190_987654321.arc i.e need delete 30 files in above case user give below inputs
start_file = 452161 end_file = 452190 how delete above series files? (i new bash/shell programming tried using while loop , remove dint work seeking experts help)
my code
echo "enter start file" read start echo "enter end file" read end i=$start j=$end while [$i -le $j]; rm *$i*.arc ((i++)) done
replace after fourth line by
for ((i=$start; i<=$end; i++)); echo rm *_${i}_*.arc done if looks fine, remove echo.
Comments
Post a Comment