Sorry about code tags, actually I didn't know how do it.
@Don, Please see in line my answers to your queries.
Do you want to COPY and compress or MOVE and compress? (I.e., do you want to leave an unmodified version of the file where it is while creating a compressed version of the file somewhere else, or do you just want to create a compressed version of the file somewhere else and remove the original file?)
[Jacky]: I want to COPY and compress files in a single command line using zip/gzip or any other command. I dont want to disturb oringinal files in the source directory (/dump/traces/...)
What is the name of the directory containing these files?
[Jacky]:
Source Dir = /opt/TGS/traces
Target Dir = /dump/old_traces
What is the name of the directory in which you want to create the compressed copies of your files?
[Jacky]: /dump/old_traces
What utility do you want to use to compress your files? (Some possibilities include compress , pack , and zip .)
[Jacky]: zip
What do you mean by yesterday? (Are you looking for files that are 24 to 48 hours old when you run the script? Or, are you looking for files that were created between midnight at the start of yesterday and midnight at the start of today?)
[Jacky]: For example, below you can see the list of files. So now I want to copy/compress all files of 3rd Feb only (i.e. yesterday).
Thanks,
Regards,
Moderator's Comments:
Directions, including a tutorial video, showing you how to use CODE tags and ICODE tags for sample input, sample output, and for code segments was sent to you when you received your first warning for not using CODE tags.
Please review that tutorial and start formatting your posts correctly yourself. Don't depend on moderators and administrators to clean up your posts.
Last edited by Don Cragun; 02-04-2016 at 02:46 PM..
Reason: Add CODE and ICODE tags.
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)
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)
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)
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)
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)
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)
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)
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)