I need to tar some files in a directory to a remote server.
Is this the correct way to do it to change it to a .gz format :
No. Actually it is lke this (i will do this step by step so that you can understand what is done):
This means that gzip is getting data from stdin, packing them and sending the result to stdout, which is pointed to the file dir.tar.gz.
So far, so good, but now you need to to make tar putting its output to (its) stdout, because this is what a pipe does: connecting one process' stdout to the next process' stdin. Therefore you need to tell tar to not create a tar-file, but to direct the output to stdout:
Notice, btw., that tar is not driven by options but subcommands. Therefore the introducing "-" is wrong. Everything else is still as in the e working example you found, with the exception of the non-standard "z" command (that works only for tar, which have a "built-in" gzip):
Quote:
Originally Posted by anaigini45
How do i do the same to send it over to a remote server?
The same way you alread tried: instead of writing the file to disk (> /output/file), you can use another pipeline to move it to another server and eventually unpack it there:
Notice that this instance is one of the select few moments where a seemingly UUOC is justified. At i am not aware of any other way of making gzip look at its stdin for incoming data.
I would like to back up several directories weekly using a cronjob.
I'm not experienced in UNIX, but I would start like this:
tar -cvf backup.tar dir1 dir2 dir3
Now if a file is being modified in the process it will result in an error.
How can I prevent this from happening and how can I... (5 Replies)
Say I want to transfer several dump files from a Solaris machine onto a Win2k machine for storage. It was suggested that I tar and gzip the dump files before doing so.
Is it completely necessary to use both of these utilities, or is it sufficient to compress multiple dump files into one gzip... (4 Replies)
Hi,
I am facing a weired problem in my FTP script. I want to transfer multiple files from remote server to local server everyday, using mget * in my script. I also, want to send an email for successful or failed FTP. My script works for file transfer, but it don't send any mail. There is... (2 Replies)
dears,
I have a folder containing huge no. of files, some of them are created on AUG 16, AUG 17 and AUG 18, for example.
All I want to do is tarring all the files created on a certain date, say AUG 18, in one tar file, only in one command line.
So, how to feed all the files created on a certain... (4 Replies)
hi guys,
i'm totally new with Unix sripting and no idea how to do the scripting at all. My problem is that my boss asked me to do this:
1.) create a script that will tar or gzip the files in particular directory
eg:
i'm on my home directory and I need to tar/gzip the file in.. assuming... (1 Reply)
HI All,
Im encountering behaviour that is not correct for my requirements when I untar a file.
Im using the below command to tar up files from various folders to the ARCHIVE folder as below...
tar -cvf "$ARCHIVE_PATH"/"$dte_tar_filename" "$LOG_PATH" "$PROCESSED_PATH2" "$ERROR_PATH"
... (5 Replies)
Hi I need help in tarring files up to four days old. I have been doing this:
find . -mtime -4|xargs tar -cvf mar4.tar
However, it seems like it's tarring everything but leaving those that are 4 days old and newer (which I want tarred and everything else not)
---------- Post updated at... (1 Reply)
Hi,
I am trying to automate the process of fetching files from remote server to local server through sftp. I have the username and password for the remote solaris server. But I need to give password manually everytime i run the script.
Can anyone help me in automating the script such that it... (3 Replies)
Hi All
I need to transfer a file from a UNIX server to a windows server.
I saw that it is possible to do this using scp command by looking at the forum listed below:
... (2 Replies)
I have a script, which connecting to remote server and first checks, if the files are there by timestamp. If not I want the script exit without error. Below is a code
TARFILE=${NAME}.tar
TARGZFILE=${NAME}.tar.gz
ssh ${DESTSERVNAME} 'cd /export/home/iciprod/download/let/monthly;... (3 Replies)