01-21-2010
Script That Can navigate to 3 differents directory & remove files under them
Hi
I am Trying to Write a script that can goto 4 different directorys on the server & remove the Files older then 30 days ??
/logs
logs1 logs2 logs3
Now I need to remove files under
logs1 logs2 logs3 which are older then 30 days whose name stat 'sit' , 'mig','bld' .
in addition
I have another directory which residing some where else i also need to remove file in that directory which is under root as /log4 are older then 30 days
I have this as of now ..
vi Archive_logscript
#!/bin/bash
cd /log/log1
find . -type f -name 'sit_*' -mtime +30 -print | xargs /bin/rm -rf
cd /log/log2
find . -type f -name 'mig_*' -mtime +30 -print | xargs /bin/rm -rf
cd /log/log3
find . -type f -name 'bld_*' -mtime +30 -print | xargs /bin/rm -rf
cd /oldfiles/log4
find . -type f -name 'pro_*' -mtime +30 -print | xargs /bin/rm -rf
exit
-----
do you think this works ??? any better suggestion ???
Last edited by Beginner123; 01-21-2010 at 05:42 PM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hello,
How do I navigate to the level ABOVE the home directory?
I have the following structure on my drive, bearing in my I'm using a cygwin port on Windows.
C:\
C:\cygwin
C:\cygwin\bin
C:\cygwin\otherfolders
C:\cygwin\home (the home directory)
C:\cygwin\home\H (my user directory)
... (4 Replies)
Discussion started by: patwa
4 Replies
2. Shell Programming and Scripting
I am trying to install some applications, on my linux OS and all the instructions are tell me that ill have to navigate to the directories and type the link that they provide, but i try typing 'dir' which shows me the directories but to access a particular one i can't remember how??? can anyone... (2 Replies)
Discussion started by: kprescod4158
2 Replies
3. Shell Programming and Scripting
Hi I need to write a shell script which basically searches for all the empty files within the directory structure, lists them before asking the user to confirm if they would like to delete them. If the user deletes the file then a notice would appear confirming the file is deleted.
I've be... (5 Replies)
Discussion started by: cat123
5 Replies
4. AIX
i have a user 'bart' which does not belong to apps group (as shown below) and i want him to be able to navigate to TEST directory.. i gave him read access but he cannot get through. when i added execute permission he was able to navigate to TEST
drwxr-xr-- 3 draco apps 4096 Apr... (2 Replies)
Discussion started by: chipahoys
2 Replies
5. Shell Programming and Scripting
Hello,
I just saw that on my vps (centOS) my oscommerce with a seo script
has created millions of tmp files inside the /html/cache/ directory.
I would need to remove all those files (millions), I tried via shell but the vps
loads goes to very high and it hangs, is there some way to do a... (7 Replies)
Discussion started by: andymc1
7 Replies
6. Programming
Hi Team,
I have thousands of TIF files which are converted from PDF. Below is a sample of it.
LH9406_BLANCARAMOS_2012041812103210320001.tif
LH9406_BLANCARAMOS_2012041812103210320002.tif
LH9406_BLANCARAMOS_2012041812103210320003.tif
LH9411_ANGENIAHUTCHINSON_2012041812102510250001.tif... (9 Replies)
Discussion started by: paragnehete
9 Replies
7. Shell Programming and Scripting
Hi All,
Am new to both Unix & this Forum - Need some help on a script that I am trying to write:
In a Directory i have few text files which might or might not contain some text that I am trying to find.
Once that text is found in any of the files, it needs to be removed from the file
... (6 Replies)
Discussion started by: rituparna_gupta
6 Replies
8. UNIX for Dummies Questions & Answers
Hi,
Currently i'm logging as a user say atgdev. When I login it takes me to directory /.
I see the home directory set as /home/atgdev/
I want that when i log in it shud directly go to my home directory i.e /home/atgdev/.
I thought .profile in /home/atgdev/ will be invoked first when i log... (9 Replies)
Discussion started by: Gangadhar Reddy
9 Replies
9. UNIX for Dummies Questions & Answers
Hi Folks,
There is a job which generates a .zip files every day at /usr/app/generated directory , now please advise for the script that will delete this zip files permanently.but while deleting it should make sure that it will not delete the last two days recently generated zip files and this... (1 Reply)
Discussion started by: punpun66
1 Replies
10. How to Post in the The UNIX and Linux Forums
Hi ,
i am a new user to this forum can anyone please help me in navigation for this forum.
also when i am trying to open any thread i am getting below error.
Bad Request
Your browser sent a request that this server could not understand.]
Thanks. (1 Reply)
Discussion started by: nkchand
1 Replies
BZEXE(1) General Commands Manual BZEXE(1)
NAME
bzexe - compress executable files in place
SYNOPSIS
bzexe [ name ... ]
DESCRIPTION
The bzexe utility allows you to compress executables in place and have them automatically uncompress and execute when you run them (at a
penalty in performance). For example if you execute ``bzexe /bin/cat'' it will create the following two files:
-r-xr-xr-x 1 root bin 9644 Feb 11 11:16 /bin/cat
-r-xr-xr-x 1 bin bin 24576 Nov 23 13:21 /bin/cat~
/bin/cat~ is the original file and /bin/cat is the self-uncompressing executable file. You can remove /bin/cat~ once you are sure that
/bin/cat works properly.
This utility is most useful on systems with very small disks.
OPTIONS
-d Decompress the given executables instead of compressing them.
SEE ALSO
bzip2(1), znew(1), zmore(1), zcmp(1), zforce(1)
CAVEATS
The compressed executable is a shell script. This may create some security holes. In particular, the compressed executable relies on the
PATH environment variable to find gzip and some other utilities (tail, chmod, ln, sleep).
BUGS
bzexe attempts to retain the original file attributes on the compressed executable, but you may have to fix them manually in some cases,
using chmod or chown.
BZEXE(1)