Create a tar archive called my-directory.tar of my-directory/ without the parent directory.
You can use this short tar command.
              
                  tar -C my-directory -cvf my-directory.tar .
              
          
      Or this more verbose tar command.
              
                  tar --cd my-directory --create --verbose --file my-directory.tar .
              
          
      Make sure you include the trailing ., as this tells tar to include everything from the root of the directory once it's done the cd.
-C, --cd or --directory tells tar to change (cd) into the directory before creating, listing, extracting, appending to etc. the archive-c or --create tells tar to create a new archivev or --verbosetells tar to produce verbose outputf or --filetells tar that the next parameter will be the tar file to create, extract, append to, list, etc.