Error while creating .tar file using script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Error while creating .tar file using script
# 1  
Old 12-30-2005
Error while creating .tar file using script

Hi,

I am getting following error while running script:

tar: can't change directories to /home/xyz/script: No such file or directory
tar: compress: No such file or directory
tar: getts.tar same as archive file

Following is my script:

#!/bin/bash

echo "You want:"
echo "1. zip files."
echo "2. remove files."
echo -n "Enter your option:"
read opt

echo -n "Enter full File path:"
read PATH
echo -n "Enter File name:"
read FILE

if [ $opt -eq 1 ]
then
#zip files

/usr/bin/tar -cvf $FILE.tar $PATH compress $FILE.tar

fi


Can some one give some solution.

thanks
# 2  
Old 12-30-2005
read PATH

Gack!! Don't do that! PATH is a special variable that tells the shell where to find commands. Use some other name.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How to create .tgz file without creating .tar file?

Hi, Could anyone help me in providing command to generate .tgz file without creating .tar file? currently i am using below command for doing the same but if tar file has big size and there is no space in drive then tgz file will not be generated. I want to generate tgz file directly without... (4 Replies)
Discussion started by: Pawan Kumar
4 Replies

2. Shell Programming and Scripting

Tar creating copies of files

I am trying to archive directories based on their last modified date. When I tar and compress the directory it makes copies of whats inside, I don't know how to fix this. Here is my code. #!/bin/bash #AUTODRUNDISABLE VERSION="0.2" cd /desired/directory/to/archive find . -type d -newermt... (3 Replies)
Discussion started by: jrymer
3 Replies

3. Windows & DOS: Issues & Discussions

[SOLVED] Creating .tar file

Hi, How to create a .tar file in windows OS.. I need to ftp tat <filename>.tar file into AIX and untar it there and will use for futher actions.. Please help.. Thanks in advance.. (2 Replies)
Discussion started by: Priya Amaresh
2 Replies

4. UNIX for Dummies Questions & Answers

Creating a TAR

Hello , I have a unix script to create a TAR which is invoked from Mainframe job. #!/bin/ksh echo "Start Time : " $(date +%m-%d.%H.%M.%S) echo "*************************" tdate=$(date +_%m%d_%H%M%S) cmdfil="/usr/lpp/web-data/mfg/nct/file-data/ftpcmd.dat"... (6 Replies)
Discussion started by: gayathrivm
6 Replies

5. Solaris

How to extract files from a tar file without creating the directories?

Hello all. I have a tar file that contains a number of files that are stored in different directories. If I extract this tar file with -xvf , the directories get created. Is there a way to extract all of the files into one directory without creating the directories stored in the tar file. (9 Replies)
Discussion started by: gkb
9 Replies

6. UNIX for Dummies Questions & Answers

Creating a Tar file while files are spooling

Hi I have done a search for this but couldn't find much on it. I am creating a tar file with the command below tar cvf /export/home/user/backup/*Will this is being created I have a job spooling to 5 texts files in the following directory /export/home/user/backup/STATS/ The tar files... (1 Reply)
Discussion started by: sgarvan
1 Replies

7. Shell Programming and Scripting

Creating tar excluding links

hi, How do i create a tar file of a directory excluding the links in that particular directory and its sub-directories. The below command doesnt work for me. tar -cvf abc.tar /dir1 --exclude"^l" (1 Reply)
Discussion started by: yesmani
1 Replies

8. UNIX for Dummies Questions & Answers

Creating tar file for subdirs, excluding one and preserving user info

Hi All, I am not one of the super users / root for AIX 5.3 system. There is a filesystem Say /DIR1 and its has several subdirs in it say SUBDIR1, SUBDIR2, SUBDIR3. Can I create a tar file for all files under DIR1 and SUBDIR1, SUBDIR3. Excluding SIBDIR2? Also how can I preserve... (2 Replies)
Discussion started by: Hangman2
2 Replies

9. 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

10. UNIX for Dummies Questions & Answers

extract tar files without creating directory

I received a tar file of a directory with 50,000 files in it. Is it possible to extract the files in the tar file without first creating the directory? ie. Doing tar -xvf filename.tar extracts as follows: x directory/file1.txt x directory/file2.txt . . . I would like to avoid... (4 Replies)
Discussion started by: here2learn
4 Replies
Login or Register to Ask a Question