Permission with Tar files


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Permission with Tar files
# 1  
Old 09-15-2009
Permission with Tar files

Hi All,
I have 1000's of xml files in the Windows environment which needs to be FTPed to the UNIX environment.
to reduce the time taken i go in for Tar and gzip
1. At the windows server i use the following command to tar and gzip
tar --remove-files -pcf DW_BankDrop.tar DW_BankDrop*.xml
gzip -r9 DW_BankDrop.tar
This yields me a file DW_BankDrop.tar.gz
2. I FTP this .tar.gz file to the UNIX environment and perform
chmod 777 Pathname/DW_BankDrop.tar.gz
gunzip Pathname/DW_BankDrop.tar.gz
tar pxvf Pathname/DW_BankDrop.tar

this commands unzips and untars the files but the permission of untarred file becomes 666... Is it possible to retain the same 777 permission which was given for the .tar.gz file earlier in this command(chmod 777 Pathname/DW_*.gz)?

another question: Is it possible to delete the .tar file once its being untarred in the same command? (like --remove-files in case of windows environment)
Kindly help me.
# 2  
Old 09-15-2009
Quote:
Originally Posted by Codesearcher
Hi All,
I have 1000's of xml files in the Windows environment which needs to be FTPed to the UNIX environment.
to reduce the time taken i go in for Tar and gzip
1. At the windows server i use the following command to tar and gzip
tar --remove-files -pcf DW_BankDrop.tar DW_BankDrop*.xml
gzip -r9 DW_BankDrop.tar
This yields me a file DW_BankDrop.tar.gz
2. I FTP this .tar.gz file to the UNIX environment and perform
chmod 777 Pathname/DW_BankDrop.tar.gz
gunzip Pathname/DW_BankDrop.tar.gz
tar pxvf Pathname/DW_BankDrop.tar

this commands unzips and untars the files but the permission of untarred file becomes 666... Is it possible to retain the same 777 permission which was given for the .tar.gz file earlier in this command(chmod 777 Pathname/DW_*.gz)?
What on earth for? The executable bit is pointless on anything but directories, scripts, and executables. The 666 permissions you already have mean "read/write access for everyone". And I do mean everyone. You might want to check your umask...
Quote:
another question: Is it possible to delete the .tar file once its being untarred in the same command? (like --remove-files in case of windows environment)
Not that I can see. tar treats the archive file as a stream, not a file, so doesn't have options like that. Not a big deal, just 'rm filename' to delete it after.
# 3  
Old 09-15-2009
On the subject of file creation permissions, see "man umask".
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to create zip/gz/tar files for if the files are older than particular days in UNIX or Linux?

I need a script file for backup (zip or tar or gz) of old log files in our unix server (causing the space problem). Could you please help me to create the zip or gz files for each log files in current directory and sub-directories also? I found one command which is to create gz file for the... (4 Replies)
Discussion started by: Mallikgm
4 Replies

2. Solaris

Command to remove existing files in the tar files in Solaris 10

Hi, I am using solaris 10 OS.Please help me out with the commands needed in below two scenarios. 1)How to delete the existing files in the tar file. suppose i have a main tarfile named application.tar and it contains a file called ingres.tar. what is the command to remove ingres.tar... (2 Replies)
Discussion started by: muraliinfy04
2 Replies

3. UNIX for Dummies Questions & Answers

How to tar all files except logs and .txt files

Hi I greatly appreciate the forum and the people here very helpful :) I could able to tar all the directories, sub dirs and the files. But unable to tar all the directories excluding the log and text files. Can anyone please advise the exact command to use for excluding .log and .txt? PS:... (4 Replies)
Discussion started by: Olivia
4 Replies

4. Shell Programming and Scripting

tar command to explore multiple layers of tar and tar.gz files

Hi all, I have a tar file and inside that tar file is a folder with additional tar.gz files. What I want to do is look inside the first tar file and then find the second tar file I'm looking for, look inside that tar.gz file to find a certain directory. I'm encountering issues by trying to... (1 Reply)
Discussion started by: bashnewbee
1 Replies

5. UNIX for Dummies Questions & Answers

tar -cvf test.tar `find . -mtime -1 -type f` only tar 1 file

Hi all, 4 files are returned when i issue 'find . -mtime -1 -type f -ls'. ./ora_475244.aud ./ora_671958.aud ./ora_934052.aud ./ora_934050.aud However, when I issued the below command: tar -cvf test.tar `find . -mtime -1 -type f`, the tar file only contains the 1st file -... (2 Replies)
Discussion started by: ahSher
2 Replies

6. UNIX for Advanced & Expert Users

How to create a Tar of multiple Files in Unix and FTP the tar to Windows.

Hi, On my Unix Server in my directory, I have 70 files distributed in the following directories (which have several other files too). These files include C Source Files, Shell Script Source Files, Binary Files, Object Files. a) /usr/users/oracle/bin b) /usr/users/oracle... (1 Reply)
Discussion started by: marconi
1 Replies

7. UNIX for Dummies Questions & Answers

.tar.tar files

I downloaded what I thought was a gziped file (at least on remote server it had a .gz extention) and once I had it it was filename.tar.tar..I tried the standard untar tar -xvf filename on it and get an error. Does anyone know what's going on? (5 Replies)
Discussion started by: capeme
5 Replies

8. Shell Programming and Scripting

How to process the files using .tar.gz files in script

Hi, I have some file in /users/xyz directoty with .tar.gz extension. i need to find these files and if found in need to run other commands. I now the command for finding files,but how to put if condition ?please help me Thanks (3 Replies)
Discussion started by: bmkreddy
3 Replies

9. UNIX for Advanced & Expert Users

Untaring *.tar.tar files

Hi all, How to untar a file with .tar.tar extension. A utility that i downloaded from net had this extension. Thanks in advance, bubeshj. (6 Replies)
Discussion started by: bubeshj
6 Replies

10. UNIX for Advanced & Expert Users

tar : permission denied

Hi, when I launch : tar cf - *|rsh ${HOST} -l user "cd /u02/db/appl;tar xf -" I have this error message when execute tar : tar: admin/out/appsutil/appsutil/template/addbprf.sh: Permission denied I want to know if the permission on source file is wrong or on destination we (tar) have(s) not... (0 Replies)
Discussion started by: big123456
0 Replies
Login or Register to Ask a Question