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.
I made a test directory because the actual directories I will be working with are massive and so to same time in compression I created /test/sub_dir/test.txt.
When I run my script this is what it compresses.
./test/
./test/sub_dir/
./test/sub_dir/test.txt
./test/sub_dir/
./test/sub_dir/test.txt
I'm not sure that any of the above commands really work... Not because the find doesn't work, but because of the way you're using tar.
Ordinary tar does not read filenames from standard input. I think GNU tar can but that's an extension.
Vryali's find will run tar once for each individual file, overwriting the tarball every time -- almost certainly not what you want.
Change it a bit to dump more than one file into tar like so:
Note that, given enough files, xargs will run tar more than once, ergo you have to use the 'append' mode to get a valid file when that happens. You can't append a compressed file, so you have to compress afterwards.
theres a situation i'm dealing with where i feel like folks are stealing some of my files. they copy it (because they have complete sudo root access like i do) from my home directory and they copy it wherever and then change the name of the file so i wont know that they have it.
is there a way... (1 Reply)
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)
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)
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)
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)
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)
Under Leopard, I like to conveniently open Terminal windows onto remote systems. I've created several settings files in Terminal, one for each remote system that I want to access. To open window, I right-click on the Terminal icon in the Dock, expand the "New Window" menu item, and select the... (0 Replies)
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)
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)
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)