I have a program that implements an archive and I need to extract files from the created archive. I intend on doing so by creating a new file. I already have the file name/user id/group id/ date/ mode (permissions)/ etc. So how would I create a file with these given attributes?
Share
On creating a File, certain properties are automatically set. This includes the Owner & Time/Date. You can specify the name of the file to be created, but the file is automatically owned by you and inherits your user ID and group ID (i.e.. of the one executing the program) – This is system generated and is done so for security reasons (what if you did not have access to an other user’s credentials?). You can however change the owner or group (chown/chgrp) & even change the file permissions (chmod), once the file has been created. If you wish to execute a single command, you can simply append these commands (using ;).