delete old files
Dear All,
I have a partition which is 90% filled.. I want to keep one month files in that disk and delete all the old files.. how do I acheive this ? output of ls -rlt like this : rw-r----- 1 oraprod dba 10484224 Nov 3 10:05 prod_arch_5556.arc -rw-r----- 1 oraprod dba 10484224 Nov 3 10:24 prod_arch_5557.arc -rw-r----- 1 oraprod dba 10484224 Nov 3 10:40 prod_arch_5558.arc -rw-r----- 1 oraprod dba 10484224 Nov 3 10:58 prod_arch_5559.arc -rw-r----- 1 oraprod dba 10484224 Nov 3 11:15 prod_arch_5560.arc -rw-r----- 1 oraprod dba 10484224 Nov 3 11:34 prod_arch_5561.arc -rw-r----- 1 oraprod dba 10484224 Nov 3 11:54 prod_arch_5562.arc -rw-r----- 1 oraprod dba 10484224 Nov 3 12:13 prod_arch_5563.arc -rw-r----- 1 oraprod dba 10484224 Nov 3 12:32 prod_arch_5564.arc Please guide me Thanks Yusuf |
If this is a directory that contains files that can be removed after a certain time, and there are no subdirectories where files must be kept.
you could try: Code:
find /path/to/directory -type f -mtime +31|xargs ls -l Code:
find /path/to/directory -type f -mtime +31|xargs rm -f the ls -l would show the contents of the current directory, and the rm command would not remove any files. |
thanks disillusionist.. but..
Quote:
Thanks for your answer.. but.. [oraprod@alioracle prodarch]$ find /d03/oraprod/prodarch -type f -mtime +31|xargs ls -l | wc -l 2819 the above is 100% ok,, but whereas when I try to delete the files,am getting error like : [oraprod@alioracle prodarch]$ find /d03/oraprod/prodarch -type f -mtime +31|xargs ls -l | rm -rf xargs: ls: terminated by signal 13 Please guide me.. Thanks in advance Yusuf |
Don't have the "ls" command in the pipe.
Code:
find /d03/oraprod/prodarch -type f -mtime +31 |xargs rm -rf |
thanks .. it is working fine..
Quote:
Thanks a lot disillunioist and jschiwal for your kind answers.. I fixed it using your help.. this forum is really helping newbies like me.. thanks Yusuf |
Yusufs
This looks like you are removing oracle archive file. If this is the case, you must run an RMAN crosscheck before the next backup otherwise the backup will fail! |
Rman
Quote:
Thanks Disilluionist for your comments.. anyway we are not taking hotbackup.. we can managed to take full cold backup and we are not using rman.. Thanks for your patience and ideas Yusuf |
If you are not taking hot backups why have the database in archive log mode?
If the archive area runs out of space the database will not perform any updates until space is created. If your cold backup kicks in at this point, it will be unable to shutdown the database cleanly and therefore you would be backing up open database files which will leave the database unrecoverable. |
All times are GMT -5. The time now is 01:54 AM. |