Zip a file without directory

Hi

I was trying to zip some file in a directory using the below command.

find /dir1/dir2/ -name "asdf*.txt" -print | zip -m /dir1/dir2/dir3/asd_Date.zip  -@

Its getting zipped.But when I am trying to unzip,

Its getting unzipped with full directory structure.

Is there any command to zip without directory structure

So, a few questions to help us first:-

  • What output/errors are you getting?
  • What OS and version?

That should get us some useful information to help if it's not a simple fix, but have you tried changing to the directory /dir1/dir2 and running your command giving the find the starting point of just a . to specify the current directory?

cd /dir1/dir2
find . -name "asdf*.txt" -print | zip -m /dir1/dir2/dir3/asd_Date.zip  -@

If you zip with the full path, it will extract to exactly the same location.

Robin