1

I wrote a shell script to move *.html files from 100 folders.

cd 1498224124_1_OCR ; python obatchocr.py ; mv *.html /var/www/html/ocr/ocr-by-batch-number/  ; cd ../
cd 1498224124_2_OCR ; python obatchocr.py ; mv *.html /var/www/html/ocr/ocr-by-batch-number/  ; cd ../

Actually, few folders does not have *.html file. I want to find the folders which does not have *.html file. So, i want to delete the folder if there is *.html move is success by shell script.

1 Answer 1

1

All you need to do is test if the end of the file ends with ".html"

To do this, here is the written code. You should easily be able to translate this into what you are doing.

for every file in folder
if name.end == ".html":
move file
else
delete file

This is not the exact code you will need to use, but hopefully this has helped :)

Not the answer you're looking for? Browse other questions tagged or ask your own question.