copying


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers copying
# 1  
Old 11-18-2003
copying

I am using AIX version 5.1
I would like to copy my log files to another directory and timestamp them or add the date to the file name so I can distinguish them apart and keep 4weeks of files in this directory.
so I usally do this

cp rptlog /dump/backup.log.files

I would like the the file name after I copy it to the /dump to be rptlog111603
Can I do this ?

cp rptlog /dump/backup.log.files/rptlog111603
or would it be

cp rptlog /dump/backup.log.files rptlog111603

Thank you
# 2  
Old 11-18-2003
...........

cp rptlog /dump/backup.log.files/rptlog111603

you could try such easy steps with small files ...

greetings Preßy
# 3  
Old 11-18-2003
copying2

cp rptlog /dump/backup.log.files/rptlog111603



thank you the above worked great


Rocker
# 4  
Old 11-18-2003
You can make it even more dynamic and less error prone (assuming that you are scripting this) by making the date string an automatic:

cp rptlog /dump/backup.log.files/rptlog`date +%m%d%y`

I'd more prone to setup your dates in a year - month - day format so listings make more sense

cp rptlog /dump/backup.log.files/rptlog`date +%y%m%d`

Cheers,
Keith
# 5  
Old 11-18-2003
Second thought, "+%Y%m%d" would be better

Keith
# 6  
Old 11-18-2003
script

Kieth are you talking about making a cron script ?
Also what does the + do ? If this is in a Cron it will add a day or week ? Or will it add the current day?
I will be putting a cron to do this every week on friday if that helps.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need help in copying the file once

hi all , i had a following problem in my script filename=oas/data/output.txt printf"content1" >> $filename printf"content2" >> $filename printf"content3" >> $filename printf"content4" >> $filename printf"content5" >> $filename printf"content6" >> $filename my contents are different... (6 Replies)
Discussion started by: hemanthsaikumar
6 Replies

2. Shell Programming and Scripting

copying with a certain extension

trying to copy all the files without extension then add "*.txt" but its not working is there any other way and i do not want to use cpio -vdump just want to use copy command FROM=/usr/share/doc TO=/aleza/doc #the follow function copies all the files without extensions call(){ cd $FROM... (3 Replies)
Discussion started by: elginmulizwa
3 Replies

3. Shell Programming and Scripting

Copying only the file name

Hi I just want to copy the file name from the input file. Below is the code I have used but the answer comes with quotation . $ cat test.sh file_name=\'$1\' echo $file_name $ sh test.sh grants.dat 'grants.dat' How do I remove the quotation Thanks (2 Replies)
Discussion started by: Krishnaramjis
2 Replies

4. UNIX for Dummies Questions & Answers

Please, I need help with copying a file.

Hello. I don't know much about UNIX. Here is a problem I need to resolve. There is a file "file1.txt". It contains the line "End Of Copy" somewhere in the middle. I need to copy file1.txt to another file, "file2.txt" until this line. So, if the "file1.txt" is Line 1 Line 2 Line 3... (3 Replies)
Discussion started by: Eugene
3 Replies

5. Solaris

Copying Files and

I am new user to solaris and installed solaris operating system on full Harddisk 120Gb. I am unable to copy music files to desktop and /home directory. One thing happened while registering is- i entered login-root and its password. The message prompted your system is crashed. Is it because of... (1 Reply)
Discussion started by: patilmukundraj
1 Replies

6. Programming

Copying!

Can anybody point out the difference between shallow copying, deep copying and bitwise copying in C++? (2 Replies)
Discussion started by: areef4u
2 Replies

7. UNIX for Dummies Questions & Answers

copying file

is there anyway to copy a file which i don't have permission? (1 Reply)
Discussion started by: dakid
1 Replies

8. UNIX for Dummies Questions & Answers

copying a file to another

hi group... needed some help regarding this requirement actually we have a set of zip files in a server we have two types of zip files one as usual .zip extension and one with .zip_m extension... we need to copy the files from .zip_m extension to .zip extension with same file name ... it... (2 Replies)
Discussion started by: madhu_aqua14
2 Replies

9. Programming

copying a file

hello, i have to copy a file from one directory to another directory in linux. how to do this using a c function? kindly ans to my query. thanks (2 Replies)
Discussion started by: svh
2 Replies
Login or Register to Ask a Question