I have zip file 20240520_172204_NV0001_TEST-1.zip
containts more file extension, about 4 files
NV0001
NV0001.txt
NV0001.xml
NV0001.img
I want to get file name to variable and do something with file name. The file name should be NV0001
, priority with extension .xml
, checking if file extension is .xml
and get file name, exception with .txt
and .img
. How can i do it ?
#!/bin/bash
zipfile="/home/category1/sub1/20240520_172204_NV0001_TEST-1.zip"
filename=""
filename="unzip -Z1 $zipfile | grep -v '/$'"
echo "$filename"