Sponsored Content
Top Forums Shell Programming and Scripting Shell script to check a file and delete old files Post 302983467 by hasn318 on Tuesday 11th of October 2016 04:54:47 PM
Old 10-11-2016
Code:
ls -al /nim/dr/HMCBackup/\* | grep -e .tgz

the above command gives me the .tgz files any idea how to incorporate the age of the files into it?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

how to delete empty files in a shell script

I'm trying to figure out a way to delete empty files in a directory. I have a cron that runs and creates a flat file every 15 mins. However, most times at night the flat file will be empty. I'd like to run a script to delete empty files that end with *.dat Any suggestions? Rich (1 Reply)
Discussion started by: rpnuge
1 Replies

2. Shell Programming and Scripting

How to delete files in UNIX using shell script

Hi, I have the following task to perform using shell script. The user will provide a directory name along with a date. The script will delete all the files in the specified directory that was created earlier to that date. Also it should display the number of files that has been deleted. ... (7 Replies)
Discussion started by: theguy16
7 Replies

3. Shell Programming and Scripting

Script to Delete temp files and check file system

Hi all, new to the threads as well as Unix/Linux. I need to create a script that will delete any temporary files as well as check the files on the system for errors or corruption. This is what I have so far and I'm sure that I'm missing things or have the wrong commands. I'm not sure where to go... (3 Replies)
Discussion started by: Bwood1377
3 Replies

4. Shell Programming and Scripting

shell script for delete old files

i want to delete all the files in my directory except the latest one. i need to do this from shell script. say i have a.txt - latest file b.txt, c.txt.. it should delete all the files except a.txt? (4 Replies)
Discussion started by: krishnarao
4 Replies

5. Shell Programming and Scripting

perl script to check if empty files are created and delete them and run a shell script

I have a local linux machine in which the files are dumped by a remote ubuntu server. If the process in remote server has any problem then empty files are created in local machine. Is there any way using perl script to check if the empty files are being created and delete them and then run a shell... (2 Replies)
Discussion started by: hussa1n
2 Replies

6. Shell Programming and Scripting

shell script to take input from a text file and perform check on each servers and copy files

HI all, I want to script where all the server names will be in a text file like server1 server2 server3 . and the script should take servernames from a text file and perform copy of files if the files are not present on those servers.after which it should take next servername till the end of... (0 Replies)
Discussion started by: joseph.dmello
0 Replies

7. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies

8. Shell Programming and Scripting

Shell script to check files if exist else touch the file

Hi All, Thanks in Advance I wrote the following code if then echo "version is 1.1" for i in "subscriber promplan mapping dedicatedaccount faflistSub faflistAcc accumulator pam_account" do FILE="SDP_DUMP_$i.csv" echo "$FILE" ... (5 Replies)
Discussion started by: aealexanderraj
5 Replies

9. Shell Programming and Scripting

Shell Script to delete the protected files.

Hello, we have more than 100000 files in a directory which are write-protected regular file, these files are quite old and would like to delete them completely, Kindly let me know the command or peice of code to automate the process. The filenames are like below MPNT_... (6 Replies)
Discussion started by: Hadoop_Master
6 Replies

10. Shell Programming and Scripting

Shell script to delete the ip address from files

Hello, I am new to shell scripting, need help, my requirement is to delete the ip address from serveral files, please suggest (2 Replies)
Discussion started by: manoj.solaris
2 Replies
POSTINSTALL(8)						    BSD System Manager's Manual 					    POSTINSTALL(8)

NAME
postinstall -- check and fix installation after system upgrades SYNOPSIS
postinstall [-a arch] [-d destdir] [-m machine] [-s {srcdir | tgzdir | tgzfile}] operation [item [...]] DESCRIPTION
The postinstall utility performs post-installation checks and/or fixes on a system's configuration files. It is especially useful after sys- tem upgrades, e.g. after updating from NetBSD 1.6.2 to NetBSD 2.0. The items to check or fix are divided in two groups: enabled by default and disabled by default. The latter are items that are dangerous for some reason, for example because they remove files which may be still in use. If no items are provided, the default checks or fixes are applied. Those which are disabled by default must be provided explicitly. Supported options: -a arch MACHINE_ARCH. Defaults to machine of the host operating system. -d destdir Destination directory to check. Defaults to /. -m machine MACHINE. Defaults to machine of the host operating system. -s {srcdir | tgzdir | tgzfile} The location of the reference files, or the NetBSD source files used to create the reference files. This may be speci- fied in one of three ways: -s srcdir The top level directory of the NetBSD source tree. By default this is /usr/src. -s tgzdir A directory in which reference files have been extracted from a binary distribution of NetBSD. The files that are distributed in the ``etc.tgz'' set file must be present. The files that are distributed in the ``xetc.tgz'' set file are optional. -s tgzfile The location of a set file (or ``tgz file'') such as ``etc.tgz'' or ``xetc.tgz'' from a binary distribu- tion of NetBSD. Each set file is a compressed archive containing reference files, which will be extracted to the temproot directory. Multiple -s options may be used to specify multiple set files. The ``etc.tgz'' set file must be specified. The ``xetc.tgz'' set file is optional. The operation argument may be one of: check Perform post-installation checks on items. diff [diff(1) options] Similar to check, but also show the differences between the files. fix Apply fixes that check determines need to be applied. Not all items can be automatically fixed by postinstall, and in some cases an error will be reported, after which manual intervention will be required. Conflicts between existing files in the target file system and new files from the NetBSD distribution are resolved by replac- ing the existing file with the new file; there is no attempt to merge the files. See etcupdate(8) for an alternative update method that is able to merge files. help Display a short help. list List available items, showing if they are enabled or disabled by default. usage Same as help. EXIT STATUS
The postinstall utility exits 0 on success, and >0 if an error occurs or a problem was found. SEE ALSO
etcupdate(8) HISTORY
The postinstall utility first appeared in NetBSD 1.6. In NetBSD 4.0, the -s tgzfile option was added. In NetBSD 5.0, the ability to specify multiple colon-separated files with a single -s option was deprecated. BSD
October 4, 2008 BSD
All times are GMT -4. The time now is 08:35 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy