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)
I want to delete a particular string ( ex : berkely@abc.com ) from different locations and in different files in each location.
Please help me ! (4 Replies)
I have av script that loops through some statistic files to create a report. We would like to only loop through non-empty files as these files create an empty report-line.
I have figured out how to find the non-empty files, but not how to loop through only those files.
Here is the code that finds... (4 Replies)
Hi everybody,
I need a script for below issue:
I have totally 15 different locations like */COUNTRY/in.
Only COUNTRy is the variable which changes for 15 countries.
For each location(one per country), there will be four files like abc_def_ddmmyyyy.txt, where ddmmyyyy is the old date.
... (1 Reply)
Hi All,
If anybody could help me with my scenario here. I have a statement file. Example of some content:
DATE DESC Debit Credit Total Rate
02-Jan-08 Lodgement 200.00 1200.00 2.51
14-Sep-07 Withdrawal 50.00 1000.00 ... (8 Replies)
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)
I'm trying to write a shell script to files of zero length in a specified directory, but I keep getting errors. Would anybody be kind enough to look it over for issues? Thanks a bunch in advance.
#!/bin/sh
if
then
if
then
find $1 -type f -size 0 -print|xargs rm
exit 0... (1 Reply)
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
LEARN ABOUT SUNOS
file
file(1B) SunOS/BSD Compatibility Package Commands file(1B)NAME
file - determine the type of a file by examining its contents
SYNOPSIS
/usr/ucb/file [-f ffile] [-cL] [-m mfile] filename...
DESCRIPTION
file performs a series of tests on each filename in an attempt to determine what it contains. If the contents of a file appear to be
ASCII text, file examines the first 512 bytes and tries to guess its language.
file uses the file /etc/magic to identify files that have some sort of magic number, that is, any file containing a numeric or string con-
stant that indicates its type.
OPTIONS -c Check for format errors in the magic number file. For reasons of efficiency, this validation is not normally carried out.
No file type-checking is done under -c.
-f ffile Get a list of filenames to identify from ffile.
-L If a file is a symbolic link, test the file the link references rather than the link itself.
-m mfile Use mfile as the name of an alternate magic number file.
EXAMPLES
Example 1: Using file on all the files in a specific user's directory.
This example illustrates the use of file on all the files in a specific user's directory:
example% pwd
/usr/blort/misc
example% /usr/ucb/file *
code: mc68020 demand paged executable
code.c: c program text
counts: ascii text
doc: roff,nroff, or eqn input text
empty.file: empty
libz: archive random library
memos: directory
project: symboliclink to /usr/project
script: executable shell script
titles: ascii text
s5.stuff: cpio archive
example%
ENVIRONMENT VARIABLES
The environment variables LC_CTYPE, LANG, and LC_default control the character classification throughout file. On entry to file, these
environment variables are checked in the following order: LC_CTYPE, LANG, and LC_default. When a valid value is found, remaining environ-
ment variables for character classification are ignored. For example, a new setting for LANG does not override the current valid character
classification rules of LC_CTYPE. When none of the values is valid, the shell character classification defaults to the POSIX.1 "C"
locale.
FILES
/etc/magic
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWscpu |
+-----------------------------+-----------------------------+
SEE ALSO magic(4), attributes(5)BUGS
file often makes mistakes. In particular, it often suggests that command files are C programs.
file does not recognize Pascal or LISP.
SunOS 5.10 14 Sep 1992 file(1B)