jeudi 28 octobre 2021

renaming picture with if stament

I am looking to have multiple find statements in if elif. When I run the script all file have the same name. the second elif does not seem to run. How can I change my script to get file 001_f to have a different name then 001_s

This is the basics of what I am trying to do

echo "Enter the file path" read path echo cd $path

echo "Enter the number" read TNum echo If find $path -iname "001" ; then (mkdir -vp admin) && (mv -i 01 admin) echo -e "Created \t $path/admin and Moved 001 files to admin elif find "$path"/admin -iname "001_s" ; then FileName<${CreateDate;DateFmt("%Y%m%d")}$TNum${CreateTime;DateFmt("%H%M")}S%.2nc.%e' $path/admin elif find "$path"/admin -iname "001_f" ; Then FileName<${CreateDate;DateFmt("%Y%m%d")}$TNum_${CreateTime;DateFmt("%H%M")}_F%.2nc.%e' $path/admin else echo "No admin directory" fi exit 0

Aucun commentaire:

Enregistrer un commentaire