Sponsored Content
Top Forums Shell Programming and Scripting Help - To copy and compress files one day ago Post 302965877 by JackyJohn on Thursday 4th of February 2016 02:41:47 AM
Old 02-04-2016
Help - To copy and compress files one day ago

Hi dears,

Hi All,
I'm a new member of this Forum. I have need your help to handle this request.

"I want to copy and Compress files not of today but of yesterday only using some script".

For example

I have the following files under a particular directory in a Solaris machine.

Code:
-rw-r--r--   1 rtp99    dba          16M Feb  3 17:29 RtpTrcError.0034
-rw-r--r--   1 rtp99    dba          16M Feb  3 18:09 RtpTrcError.0035
-rw-r--r--   1 rtp99    dba          16M Feb  3 18:56 RtpTrcError.0036
-rw-r--r--   1 rtp99    dba          16M Feb  3 19:42 RtpTrcError.0037
-rw-r--r--   1 rtp99    dba          16M Feb  3 20:35 RtpTrcError.0038
-rw-r--r--   1 rtp99    dba          16M Feb  3 21:15 RtpTrcError.0039
-rw-r--r--   1 rtp99    dba          13M Feb  3 22:15 RtpTrcError.0040
-rw-r--r--   1 rtp99    dba          10M Feb  3 23:15 RtpTrcError.0041
-rw-r--r--   1 rtp99    dba         9.2M Feb  4 00:15 RtpTrcError.0042
-rw-r--r--   1 rtp99    dba         7.0M Feb  4 01:15 RtpTrcError.0043
-rw-r--r--   1 rtp99    dba         6.9M Feb  4 02:15 RtpTrcError.0044
-rw-r--r--   1 rtp99    dba         6.6M Feb  4 03:15 RtpTrcError.0045
-rw-r--r--   1 rtp99    dba         6.0M Feb  4 04:15 RtpTrcError.0046
-rw-r--r--   1 rtp99    dba         5.1M Feb  4 05:15 RtpTrcError.0047
-rw-r--r--   1 rtp99    dba         7.8M Feb  4 06:15 RtpTrcError.0048
-rw-r--r--   1 rtp99    dba          13M Feb  4 07:15 RtpTrcError.0049
-rw-r--r--   1 rtp99    dba          15M Feb  4 08:15 RtpTrcError.0050
-rw-r--r--   1 rtp99    dba          15M Feb  4 09:15 RtpTrcError.0051
-rw-r--r--   1 rtp99    dba          16M Feb  4 09:56 RtpTrcError.0052
-rw-r--r--   1 rtp99    dba          16M Feb  4 10:26 RtpTrcError.0053
-rw-r--r--   1 rtp99    dba         6.7M Feb  4 10:40 RtpTrcError.0054

I need to copy and compress ONLY the files of yesterday (Here 3 Feb).

Any suggestion will be well appreciated.

Thanks in advance for your kind support.

Regards,

Jacky.

Last edited by Don Cragun; 02-04-2016 at 03:54 AM.. Reason: Add CODE tags.
 

9 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Compress and copy a Folder

hi Buddies , How can i Compress and move a folder through UNIX completely to windows 2000 through FTP. (1 Reply)
Discussion started by: scorpiyanz
1 Replies

2. Shell Programming and Scripting

Cron to run first day of month to calculate date 3 months ago

Hi, I would like to find out how can i calculate a date which is 3 months ago. I intend to run a cron job on the 1st of every month, and calculate the month 4 months earlier from the date. For example, if today's date is 1st May 2007, i would like to return 012007( January 2007). i can get... (1 Reply)
Discussion started by: new2ss
1 Replies

3. UNIX for Dummies Questions & Answers

Copy and compress

Is there a way to copy a file and compress it at the same time? I realize the file can be copied and then compressed, but I was wondering if it's possible to do it in a one-line command and for that matter, if it would be more efficient to perform the operation with a one-line command? Thanks. (5 Replies)
Discussion started by: here2learn
5 Replies

4. UNIX for Dummies Questions & Answers

Copy Compress as one command

Hi, I need to copy and compress files in a directory in single line of command. I am able to copy and gzip files in one command but not directory. Command that I am using for copying directory is below : cp -rp /u01/app/<directory> /u01/app/backup |gzip -r /u01/app/backup/<directory> ... (10 Replies)
Discussion started by: findprakash
10 Replies

5. Shell Programming and Scripting

How to extract the day of the year and use that info to copy a file remotely

Hello, Thank you in advance for helping a newbie who is having great trouble with this simple task. I'm allowed to copy one file remotely each night due to bandwidth restrictions. A new file gets generated once a day, and I need to copy the previous day's file. Here is what I'd like to do:... (1 Reply)
Discussion started by: tmozdzen
1 Replies

6. Shell Programming and Scripting

Help - compress file one day ago

Hi All, I'm a new member of this Forum. I have need your help to handle this request. "Compress a file name not of today but of yesterday only". For example 0 mar 08:00 TEST_RPT_STATUS_M1I_CMI20120320.xls 20 mar 08:00 TEST_RPT_STATUS_M1I_CMI20120320.rep 21 mar 08:00... (6 Replies)
Discussion started by: gio123bgg
6 Replies

7. Shell Programming and Scripting

script to compress files in directory that changes its name every day

Hi all I have the following script that should compress a file in a directory: # compress log files older than 2 days find /u01/easydone/DBDUMPS/*.dmp -mtime +2 -exec gzip {} \; BUT the problem is that these files that I want to compress are inside a directory with following format: ... (5 Replies)
Discussion started by: fretagi
5 Replies

8. UNIX for Dummies Questions & Answers

Move the files between Current day & a previous day

Hi All, I have a requirement where I need to first capture the current day & move all the files from a particular directory based on a previous day. i.e move all the files from one directory to another based on current day & a previous day. Here is what I am trying, but it gives me errors.... (2 Replies)
Discussion started by: dsfreddie
2 Replies

9. Shell Programming and Scripting

How to copy all structure folder create last day?

HI All, please help , i got same case . i want copy folder and directory create yesterday. for sample below : drwxr-xr-x 4 apps apps 33 Nov 23 04:00 xxxxxx@gmai.com drwxr-xr-x 4 apps apps 33 Nov 23 04:00 yyyyyyy@gmail.com drwxr-xr-x 4 apps apps 33 Nov 24 04:00... (2 Replies)
Discussion started by: fajar_3t3
2 Replies
CUBRID_LOB2_WRITE(3)							 1						      CUBRID_LOB2_WRITE(3)

cubrid_lob2_write - Write to a lob object.

SYNOPSIS
bool cubrid_lob2_write (resource $lob_identifier, string $buf) DESCRIPTION
The cubrid_lob2_write(3) function reads as much as data from $buf and stores it to the LOB object. Note that this function can only append characters now. PARAMETERS
o $lob_identifier -Lob identifier as a result of cubrid_lob2_new(3) or get from the result set. o $buf -Data that need to be written to the lob object. RETURN VALUES
TRUE if the process is successful and FALSE for failure. EXAMPLES
Example #1 cubrid_lob2_write(3) example 1 <?php // test_lob (id INT, contents CLOB) $conn = cubrid_connect("localhost", 33000, "demodb", "dba", ""); cubrid_execute($conn,"DROP TABLE if exists test_lob"); cubrid_execute($conn,"CREATE TABLE test_lob (id INT, contents CLOB)"); $req = cubrid_prepare($conn, "INSERT INTO test_lob VALUES(2, ?)"); $lob = cubrid_lob2_new($conn, 'CLOB'); $len = cubrid_lob2_write($lob, "Hello world"); cubrid_lob2_bind($req, 1, $lob); cubrid_execute($req); cubrid_disconnect($conn); ?> Example #2 cubrid_lob2_write(3) example 2 <?php // test_lob (id INT, contents CLOB) $conn = cubrid_connect("localhost", 33000, "demodb", "dba", ""); cubrid_execute($conn,"DROP TABLE if exists test_lob"); cubrid_execute($conn,"CREATE TABLE test_lob (id INT, contents CLOB)"); $req = cubrid_prepare($conn, "INSERT INTO test_lob VALUES(1, ?)"); $lob1 = cubrid_lob2_new($conn, 'CLOB'); $len = cubrid_lob2_write($lob1, "cubrid php driver"); cubrid_lob2_bind($req, 1, $lob1); cubrid_execute($req); $req = cubrid_execute($conn, "select * from test_lob"); $row = cubrid_fetch_row($req, CUBRID_LOB); $lob2 = $row[1]; cubrid_lob2_seek($lob2, 0, CUBRID_CURSOR_LAST); $pos = cubrid_lob2_tell($lob2); print "pos before write: $pos "; cubrid_lob2_write($lob2, "Hello world"); $pos = cubrid_lob2_tell($lob2); print "pos after write: $pos "; cubrid_disconnect($conn); ?> SEE ALSO
cubrid_lob2_read(3), cubrid_lob2_seek(3), cubrid_lob2_seek64(3), cubrid_lob2_tell(3), cubrid_lob2_tell64(3), cubrid_lob2_size(3), cubrid_lob2_size64(3). PHP Documentation Group CUBRID_LOB2_WRITE(3)
All times are GMT -4. The time now is 10:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy