I am sure this has been asked before, but honestly, I cant find post talking about it.
Here is what I need:
- A tar file will be generated manually by user
- This tar file is then used within a bash shell script
My source folder structure is like this:
So, in a folder, I do have several subfolders. On each of these subfolders, I do have files and more subfolders
I want to tar the content of one of these 'day' folders, but the two ways I tried are:
Result is that tar.gz file is added to the same tar.gz file itself. These causes problem when uncompressing
This is causing, that, when I untar the file in a tmp directory, all is included in the day1 directory, this way:
What I got is:
/tmp/day1/.....
My script is expecting content in /tmp without any more subfolders
Any advise you can give me guys?
Basically what I am trying to get is just similar as we do in windows: we zip files and folders, and the unzip them in any other folder without informaton from absolute paths
To this:
/tmp/file1
/tmp/file2
/tmp/subfolder/file3
/tmp/subfolder/file4
And not this
/tmp/day1/file1
/tmp/day1/file2
/tmp/day1/subfolder/file3
/tmp/day1/subfolder/file4
As I said, if I tar with first option (tar -zcf day1.tar.gz .) I got the file tar.gz itself compressed. When uncompressing, I am getting some "you cant use utime" error
I'm confused.
Say you have directories like this
IF you want a tar ball of /month/day1, with the tar ball IN that same directory:
That creates a tar archive with an absolute path, which is not all that useful for some things.
I would like to confirm my file.tar is been tar-ed correctly before I remove them. But I have very limited disc space to untar it.
Can I just do the listing instead of actual extract it? Can I say confirm folder integrity if the listing is sucessful without problem?
tar tvf file1.tar
... (1 Reply)
Hi,
I do have question for un tar a file. I have several 'tar'ed files. For example: SRS.tar.bz2. I was trying to untar them in a linux server using the command:
tar xvjf SRS.tar.bz2
It worked perfectly. but when I open this file in my mac computer all the files are extracted into a... (7 Replies)
Hello,
Neither ‘Grep -r' nor ‘grep -R' is working in my environment. (Searching for a text pattern in the files)
Any suggestions... Using SunOS 5.9
Thanks,
Trinanjan. (1 Reply)
Hello everyone,
Just registered here, I'm kinda new to Unix :o
I've been trying to automate some processes with various Windows tools. I found that using unix scripts the result would be closest to my needs. So I installed Cygwin on Windows 7.
My folders and files are structured like this:... (7 Replies)
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)
Hi,
I want to extract myfile.war to a folder which is in the same folder with war file.I did this as normal:
jar -xvf myfile.war
But it exploded all the content of file to the same level folder instead of that I was expecting to create a folder called myfile.
This works with tar:
... (0 Replies)
How do I find files in current folder only?
We are on AIX 5.3, so maxdepth is not supported.
I tried to do this
find /dir1/dir2/dir3/dir4 -prune -type f
to display all files in /dir1/dir2/dir3/dir4 only but it does not show any files.
Somehow the -prune option works for dir3 level... (7 Replies)
Alright, I am sure this is a laughable question, but I don't know so I am going to ask anyway.
I have a little script I am writing to take information from one source, recode it in a certain way, and print to files for each subject I have data for. This all works perfectly. I just want to put... (6 Replies)
How do I pack (using tar zcvf ?) the current folder inluding all files and folders ??
I need to be sure to get all files and folders/subfolders...
Later I will unpack into a new folder on a new server..
Appreciate any help.. (3 Replies)
I know that I can type
tar -cvf myfile.tar *
to tar the current directory and all it's sub directories, but how do I tar ONLY the current directory and skip all the subdirectories? (3 Replies)