Hi, I am trying to unzip a file( $pfile, it contains a couple of files and 4 folders with subfolders and files) and have its contents go into a directory instead of into a folder in that directory (ZZZZ), I have the following script:
#Unzip the build
unzip -o "$HOME/ZZZZ/$pfile" -d "$HOME/unzipped/"
#This unzips it to ZZZZ/unzipped/$pfolder so I have to figure out the folder name
pfolder=`echo $pfile|sed 's/\..\{3\}$//'`
#prining out the folder name to make sure my code is correct
echo "$pfolder"
#Now I'm trying to copy everything to the base folder where I really wanted to unzip it in the first place
cp -r -u -f "$HOME/unzipped/$pfolder/*" "$HOME/ZZZZ/"
The last cp always fails and tells me that "cannot stat $HOME/unzipped/myunzippedfolder". when I manually type in that last line it works. The syntax is exactly the same. Help please.