Sponsored Content
Top Forums UNIX for Dummies Questions & Answers delete pattern files in sub directories Post 302111657 by adurga on Thursday 22nd of March 2007 05:19:51 AM
Old 03-22-2007
delete pattern files in sub directories

Hello friends,

I am compiling some set of SQL scripts in a set of sub directories demoed as below. After compiling log files are being created.
Each and every time after compiling time I had to go subdir by subdir to delete the log files. I am sure there should be simple way to look for all log files and delete them.

Could someone please provide the script/command to do so.

Thanks
-Durga

SQL Files
maindir/dir1/a.sql
maindir/dir1/b.sql
maindir/dir2/c.sql
maindir/dir2/dir3/d.sql
...
...
...

Log files
maindir/dir1/a.log
maindir/dir1/b.log
maindir/dir2/c.log
maindir/dir2/dir3/d.log
...
...
...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

A Batch job to delete files from various directories

Hi, I have a shell script to find files older than 'X' days ($2) in directory path ($1) and delete them. Like this: my_file_remover.sh /usr/home/c 90 Now, I need to modify this script and add it in CRON, so that it checks other directories also. Like: my_file_remover.sh /usr/home/c... (3 Replies)
Discussion started by: guruparan18
3 Replies

2. Shell Programming and Scripting

Search directories for files with zero sizes to delete

Hi, I am trying to write a script that will use ls on a directory and list the files one at a time and their size. If the size is 0 i want it to ask me if I want to delete it (yes or no). If I say yes, I want it to delete but it won't know what the file name is just from running from the script.... (2 Replies)
Discussion started by: akeenabawa
2 Replies

3. Shell Programming and Scripting

Delete files from sub-directories over 7 days

Can any one please help me in deleting all the Files over 7 days from sub-directories A, B, C... Top-Directory Sub-Directory-A File-1 File-2 ..... File-n Sub-Directory-B File-1 File-2 ..... File-n Sub-Directory-C File-1 ... (1 Reply)
Discussion started by: sureshcisco
1 Replies

4. Red Hat

Find files older than 30 days in directories and delete them

Hi, I have dummies questions: My script here can find the files in any directories older than 30 days then it will delete the files but not the directories. I would like to also be able to delete the directories that hold old files more than 30 days not just the files itself. find . -type f... (2 Replies)
Discussion started by: lamoul
2 Replies

5. UNIX for Advanced & Expert Users

Recursively delete only specified directories with given pattern

Hi All, We have a requirement to recursively delete the directories and its subdirectories older than 60 days based on timestamp (folder creation timestamp)under certain directory. However it has some specific requirements. The directories will continue to be there upto any depth. the... (0 Replies)
Discussion started by: rcvasu
0 Replies

6. Homework & Coursework Questions

Find and delete empty files and directories

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Need to make a script, to remove all empty files and folders from current category. It also should show the name... (2 Replies)
Discussion started by: Itixop
2 Replies

7. Shell Programming and Scripting

Script to go Into Directories and Find/Delete files

I have a task, I usually do manually, but with growing responsibilities I tend to forget to do this weekly, I want to write a script that automates this, but I cant seem to work it out in my head, I have the shell of it out, but need help, and you guys have helped me with EVERY problem I have... (5 Replies)
Discussion started by: gkelly1117
5 Replies

8. Shell Programming and Scripting

Delete files in group of directories

OS: SUNOS 5.10 i386 Hello guys I wrote a shell script in bash shell to delete the files less than 30 days old. The following is the script. ======================================= #!/bin/bash for dirs in `/clu04/oracle/directory_list.lst` do find $dirs -type f -mtime -30 -exec rm {} \;... (3 Replies)
Discussion started by: zacsparrow
3 Replies

9. Shell Programming and Scripting

How to delete directories and files with xargs?

Hello, i have an dynamical apache_cache that I need to clean all days (older tant one day) with an unix command : find /usr/IBM/HTTPServer/apache_cache/ -name '*' -mtime +1 -print0|xargs -0 rm -r -- but it didn't work. Could you explain me why. So I will put below all my script :... (13 Replies)
Discussion started by: steiner
13 Replies

10. UNIX for Beginners Questions & Answers

Delete Directories and its files that begin with the same character string

I wrote a shell script program that supposed to delete any directories and its files that begin with the same character string . The program is designed to delete directories and its files that are one day old or less and only the directories that begin with the same character string. The problem... (1 Reply)
Discussion started by: dellanicholson
1 Replies
ECPG(1) 						  PostgreSQL Client Applications						   ECPG(1)

NAME
ecpg - embedded SQL C preprocessor SYNOPSIS
ecpg [ option... ] file... DESCRIPTION
ecpg is the embedded SQL preprocessor for C programs. It converts C programs with embedded SQL statements to normal C code by replacing the SQL invocations with special function calls. The output files can then be processed with any C compiler tool chain. ecpg will convert each input file given on the command line to the corresponding C output file. Input files preferrably have the extension .pgc, in which case the extension will be replaced by .c to determine the output file name. If the extension of the input file is not .pgc, then the output file name is computed by appending .c to the full file name. The output file name can also be overridden using the -o option. This reference page does not describe the embedded SQL language. See the PostgreSQL Programmer's Guide for that. OPTIONS
ecpg accepts the following command-line arguments: -c Automatically generate C code from SQL code. Currently, this works for EXEC SQL TYPE. -D symbol Define a C preprocessor symbol. -I directory Specify an additional include path, used to find files included via EXEC SQL INCLUDE. Defaults are . (current directory), /usr/local/include, the PostgreSQL include directory which is defined at compile time (default: /usr/local/pgsql/include), and /usr/include, in that order. -o filename Specifies that ecpg should write all its output to the given filename. -t Turn on autocommit of transactions. In this mode, each query is automatically committed unless it is inside an explicit transaction block. In the default mode, queries are committed only when EXEC SQL COMMIT is issued. -v Print additional information including the version and the include path. ---help Show a brief summary of the command usage, then exit. --version Output version information, then exit. NOTES
When compiling the preprocessed C code files, the compiler needs to be able to find the ECPG header files in the PostgreSQL include direc- tory. Therefore, one might have to use the -I option when invoking the compiler (e.g., -I/usr/local/pgsql/include). Programs using C code with embedded SQL have to be linked against the libecpg library, for example using the flags -L/usr/local/pgsql/lib -lecpg. The value of either of these directories that is appropriate for the installation can be found out using pg_config(1). EXAMPLES
If you have an embedded SQL C source file named prog1.pgc, you can create an executable program using the following sequence of commands: ecpg prog1.pgc cc -I/usr/local/pgsql/include -c prog1.c cc -o prog1 prog1.o -L/usr/local/pgsql/lib -lecpg SEE ALSO
PostgreSQL Programmer's Guide for a more detailed description of the embedded SQL interface Application 2002-11-22 ECPG(1)
All times are GMT -4. The time now is 09:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy