Am creating a zip file in the script, when I run the script and go to the target folder and unzip the zip file I created in script, it's creating a directory and unzipping the file in that directory.
Below is the code in the script.
for fname in `cat $Filenm`
do
echo $fname
fnme=$(echo ${fname}|awk -F\/ '{print $8}')
echo $fnme>>$scriptLog
tofilename="${date_new}_${fnme}"
zip -r $tofilename.zip $fileDir/$fnme
rm $fileDir/$fnme
mv $tofilename.zip $todir
When I go to $todir
after the script execution and unzip $tofilename.zip
, it's creating the $fileDir
in the $todir
and unzipping the file there, so in $todir
I have to go into like 5 sub directories to see my text file.
I want the text file in the zip file to be unzipped into the $todir
, but not the way its happening.
Thanks in advance.