Introduction:
Are you encountering the frustrating error message “Cowardly refusing to create an empty archive” when using the tar command? If you’re struggling to understand why this error occurs and how to resolve it, you’ve come to the right place. In this blog post, we’ll delve into the reasons behind this error and provide a solution to help you overcome it. Whether you’re a beginner or an experienced user, this guide will assist you in successfully using the tar command and avoiding the “Cowardly refusing to create an empty archive” error.
Understanding the Error:
The error message “Cowardly refusing to create an empty archive” is generated when the tar command is unable to find any files or directories to include in the archive. This error occurs when the command is missing the necessary arguments to specify the files or directories to be archived. Let’s explore the solution to fix this error and successfully create the desired archive.
Resolving the Error:
To resolve the “Cowardly refusing to create an empty archive” error, you need to provide the tar command with the correct arguments to specify the files or directories you want to include in the archive. The missing argument is often a dot (.), which represents the current directory. By including the dot in your tar command, you ensure that all files and directories in the current directory are included in the archive.
Here’s an example of how to modify your tar command to resolve the error:
code
tar -c --use-compress-program=pigz -f 107668.tar -C /home/psham/projects/data_dump/2021/1076data .
In the updated command, we added a dot (.) at the end, indicating that all files and directories in the current directory (/home/psham/projects/data_dump/2021/1076data) should be included in the archive.
Conclusion:
The “Cowardly refusing to create an empty archive” error in the tar command can be easily resolved by including the appropriate arguments to specify the files or directories for archiving. By adding a dot (.) at the end of the command, you ensure that all files and directories in the current directory are included in the archive. Remember to double-check your command syntax and verify that the necessary files and directories exist before running the tar command. With these steps, you’ll be able to create archives without encountering the “Cowardly refusing to create an empty archive” error.