The tar command has option to extra a file (file_name.tgz) into given directory (directory_name). ie.,
tar -zxf file_name.tgz -C directory_name
But it fails, if I try to run the above command, without creating directory (directory_name) prior to running this. Following is the error I got:
tar: directory_name: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
Is there any option present in tar command to create this directory if not present?
The present work around I have, is by running mkdir -p directory_name in prior.