How to zip files in mac without root folder

I managed to overcome this problem using below command

>cd myfolder
>zip -r name.zip .