获取文件路径并进行处理

#!/bin/bash

get_file_path() {
    echo $1
	for file in $1/*
	do
	    if [ -f $file ]
      	then 
        	echo $file
            echo $file >> $dir
        else
            get_file_path $file
	    fi
	done
}

all_waring="all_warning.txt"
mv $all_waring all_warning.txt_last
touch $all_waring
run_logic() {
    echo "Dir:$1"
    if [ -d $1 ]
    then
      rm -r json_output
      rm -r images
      rm images.txt
      rm json_output.txt
      fcw_file="fcw_result_triggered.txt"
      if [ -f ${fcw_file} ];then
        rm $fcw_file
      fi

    	json_path="$1/json_output"
      echo $json_path
      
      mkdir json_output
      for file in $json_path/*
      do
        cp -r $file json_output/
      done

      json_file_path="json_output"
      for file in $json_file_path/*
    	do
        echo $file >> "json_output.txt"
      done

      image_path="${1#*/}"
      image_path="03_10_fcw_data/${image_path}" 
      echo $image_path

      mkdir images
      for file in $image_path/*
      do
        cp -r $file images/
      done
      rm images/*.txt


      images_file_path="images"
      for file in $images_file_path/*
    	do
        echo $file >> "images.txt"
      done
    
      rm "serialize_output.json"
      python ../merge_json.py --list_path json_output.txt --save_file serialize_output.json

      echo "--------------------------"
      LD_LIBRARY_PATH=../thirdparty/glog/lib:install/lib-ffmpeg:install/liba4 ./benchmark/display_living --image_list ./images.txt --video_info ./serialize_output.json --adas_config_file ../thirdparty/resource/config/adas_config_a4_test.json --model_file install/model/adas.tar --camera_file install/camera_config/a4_adas_camera_config.json --flc_config_file install/config/fcp_config_x86.json  --video_out 3.avi  --font_path install/font/default_font.ttc --sdk_config_file install/config/adas_sdk_config.json --debug_mode 63
       
      mv 3.avi $1
    
    # touch fcw_result_triggered.txt
    if [ -f ${fcw_file} ];then
        echo "----------- triggered warning -----------------------"
        echo $1 >> $all_waring
        cat $fcw_file >> $all_waring
        echo "---------------" >> $all_waring
        mv $fcw_file $1
    fi
    else
    	echo "$1 is not dir"
    fi
}

dataline=$(cat ./video_list.txt)
for file in $dataline
  do
    run_logic $file
    sleep 1
    echo "==============================="
  done
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值