compress a file in unix


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers compress a file in unix
# 1  
Old 05-22-2006
compress a file in unix

Hi,
I want to compress a dmp file and ftp to another machine.pls tell me the steps to compress and uncompress the file in unix
Thankyou
# 2  
Old 05-22-2006
This is the pseudo code for the question....The '$' signs are parameters passed to the script....

Make sure you check the path for your zip...

PHP Code:
/usr/local/pkware/pkzipc/pkzipc -add -path=none ${OUTPUTPATH}/${OUTPUTFILE} ${INPUTPATH}/${INPUTFILE
Once it is done, then FTP the zip file to the other server

PHP Code:
ftp -<< EOF
   verbose
   open 
${SERVER
   
$LOGON
   binary
   mput 
*.
   close
   bye
EOF 
# 3  
Old 05-22-2006
you can literally type in

compress file

and

uncompress file
# 4  
Old 05-24-2006
A word of warning on the compress command - "compress afile.txt" will compress "afile.txt" and rename it "afile.txt.Z", the original afile will no longer exist. So, if you need access to the original after compression, make a copy first!
The uncompress command (or compress -d) works whether you specify afile.txt or afile.txt.Z
# 5  
Old 05-24-2006
Here..

There are many compressing commands in UNIX/Linux: zip/unzip,gzip/gunzip,compress/uncompress,pax and so on...
Even tar command now knows to compress, for example
like tar -cvzf myarchive.tar.Z /somedirectory so there is no need to perform
compression as it does it automatically with "z" option added.

Hope it helps.

Get "UNIX in 24 hours" book or "UNIX Essentials and UNIX Core" DVD as they explain stuff like that.
# 6  
Old 05-24-2006
[QUOTE=amro1]Even tar command now knows to compress, for example
like tar -cvzf myarchive.tar.Z /somedirectory so there is no need to perform
compression as it does it automatically with "z" option added.
QUOTE]

This is not a standard behaviour in most UNIX systems. It is an extended feature of GNU tar, which may or may not be available.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compress every file

Dear Experts, I am new to this forum. Thank you for moderator to allow me to join. I have a question about automatic compression using sh and crontab on an application which runs on the Suse Linux Server 11 SP4. My question is how to compress every file in a directory into its own tar... (5 Replies)
Discussion started by: Steven_2975
5 Replies

2. HP-UX

HP-UNIX How to zip/compress files in a folder?

Environment: HP-Unix Operating System B.11.31 U ia64 I have a folder with around 2000 files. There are some files which sizes are more than 8 GB. I need to compress all the files in the folder into a single file, so that I can transfer the file. I tried with tar command, but the tar... (8 Replies)
Discussion started by: Siva SQL
8 Replies

3. UNIX for Advanced & Expert Users

UNIX: Command to compress folder and all files into a tar

I am trying to grab a folder and all the folders and files underneath it and send it from one computer to another. I basically want to compress the whole folder into a tar, tgz, or zip file so that it can be sent as one file. is there a command to compress a folder and all its contents into a tar... (7 Replies)
Discussion started by: kane4355
7 Replies

4. UNIX for Dummies Questions & Answers

Issue: Compress in unix server and FTP to windows and open the compress file using Winzip

Hi All ! We have to compress a big data file in unix server and transfer it to windows and uncompress it using winzip in windows. I have used the utility ZIP like the below. zip -e <newfilename> df2_test_extract.dat but when I compress files greater than 4 gb using zip utility, it... (4 Replies)
Discussion started by: sakthifire
4 Replies

5. Shell Programming and Scripting

Compress in UNIX ftp the uncompress in windows server

Hi all, I need a shell script that will compress all the files in the UNIX box say /output/foldre/OUT/*.out. 1. I need to compress all the .out files present in this path. 2. The compressed files shuld be FTPed to Windows server say C:\Myfiles 3. Then the FTPed files should be... (3 Replies)
Discussion started by: Codesearcher
3 Replies

6. Shell Programming and Scripting

unix script to takes the old data from a TXT file and compress them into new file

Hi, I am looking for the unix script which can takes the 2 month old data from a TXT file (there is one txt file in whiche messages are appended on daily basis) and compress them into new file.Please halp me out. (2 Replies)
Discussion started by: vpandey
2 Replies

7. HP-UX

Compress while wrting to a file using a unix pipe

I would like to know if the following can be done. route output from an sql select directly to a pipe and compress it at the same time. regards Albert (2 Replies)
Discussion started by: booyena1
2 Replies

8. UNIX for Dummies Questions & Answers

[help] Cant compress file

Anybody know what happened here? 162 lab2-36:~/try_direct/another> compress url.txt url.txt: -- file unchanged (8 Replies)
Discussion started by: endeavour1985
8 Replies

9. UNIX for Dummies Questions & Answers

Compress in Unix

I tried Compress ; gzip and bzip . And they don't always compress files to small . Can someone tell me if there is any compress tool better than those ? thanks (1 Reply)
Discussion started by: Sasuke
1 Replies

10. UNIX for Advanced & Expert Users

Unix compress-Wintel uncompress

Is it possible to compress a large Unix file (16GB), then FTP it to a Wintel machine running XP then uncompress? I have already attempted to FTP the 16GB file but it stops at 4GB because XP FAT32 formtted drives will only allow 4GB file sizes. The 16GB file in Unix(Solaris) compresses to... (3 Replies)
Discussion started by: rampart1
3 Replies
Login or Register to Ask a Question