02-06-2012
How to find empty files in a directory and write their file names in a text?
I need to find empty files in a directory and write them into a text file. Directory will contain old files as well, i need to get the empty files for the last one hour only.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
how can find length of file names in a directory.
Examp:
I have a directory with name "d1".
directory: d1
files:
aaa.log
bbb.log
abcd.log
abcdef.log
I wold like out put like:
file name legnth
aaa.log 3
bbb.log 3
abcd.log 4
abcdef.log 5 (5 Replies)
Discussion started by: koti_rama
5 Replies
2. Shell Programming and Scripting
Hi,
I have to perform an iterative function on a set of 10 files. After the first round the output files are named differently than the input files.
examples
input file name = xxxx1.yyy
output file name = xxxx1_0001.yyy
I need to rename all of the output files to the original input... (5 Replies)
Discussion started by: ligander
5 Replies
3. AIX
Hi,
I am trying to find the content of file using grep and find command and list only the file names
but i am getting entire file list of files in the directory
find . -exec grep "test" {} \; -ls
Can anyone of you correct this (2 Replies)
Discussion started by: madhu_Jagarapu
2 Replies
4. Shell Programming and Scripting
I have a script that generates a variable with the location of a file and its complete path. What i want to do is to "cd" to the directory where that file is located using the path name of the file. GIS has absolutely failed me.
For example when i run my script it generates a variable called... (1 Reply)
Discussion started by: Knome
1 Replies
5. Shell Programming and Scripting
Hi All,
I have some 50,000 HTML files in a directory. The problem is; some HTML files are duplicate versions that is wget crawled them two times and gave them file names by appending 1, 2, 3 etc after each crawl. For example, if the file index.html has been crawled several times, it has been... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies
6. UNIX for Dummies Questions & Answers
I would need a command for finding first 15000 of the file names whose 25th postion is 5 in the current directory alone.
I do have this painful command
find . -name '5*' | head -15000 | cut -c3-
please refine this.
Of course the above command also searches in the sub directories... (3 Replies)
Discussion started by: vk39221
3 Replies
7. Shell Programming and Scripting
got it figured out :) (1 Reply)
Discussion started by: sHockz
1 Replies
8. Shell Programming and Scripting
i want to display all the files which has their names in the Uppercase in a particular directory...guide.. (6 Replies)
Discussion started by: sheelsadan
6 Replies
9. UNIX for Advanced & Expert Users
Hi , Need to shell script to extracts files names and write those to another file in different directory.
input file is
inputfile.txt
abc|1|bcd.dat
123 david123
123 rudy2345
124 tinku5634
abc|1|def.dat
123 jevid123
123 qwer2345
124 ghjlk5634
abc|1|pqr.txt
123 vbjnnjh435
123 jggdy876... (9 Replies)
Discussion started by: dssyadav
9 Replies
10. Shell Programming and Scripting
If I have 5 files in a directory, what is the best way to remove specific files in it?
For example,
snps.ivg
probes.ivg
Desired output
probes.ivg
probes.txt
all.txt
Basically, removing those files with "snp" in the filename regardless of extension. Thank you :). (2 Replies)
Discussion started by: cmccabe
2 Replies
rmdir(1) General Commands Manual rmdir(1)
NAME
rmdir - Removes a directory
SYNOPSIS
rmdir [-p] [-s] directory...
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
rmdir: XCU5.0
Refer to the standards(5) reference page for more information about industry standards and associated tags.
OPTIONS
Removes all directories in a path name. For each directory argument, the directory entry it names is removed.
If the directory argument includes more than one path name component, effects equivalent to the following command occur: rmdir -p
$(dirname directory)
That is, rmdir recursively removes each directory in the path name.
OPERANDS
The path name of an empty directory to be removed.
DESCRIPTION
The rmdir command removes a directory from the system. The directory must be empty before you can remove it, and you must have write per-
mission in its parent directory. Use the ls -al command to see if a directory is empty.
If a directory and a subdirectory of that directory are specified in a single invocation of rmdir, the subdirectory must be specified
before the parent directory so that the parent directory will be empty when rmdir tries to remove it.
RESTRICTIONS
A directory must be empty before you can remove it, and you must have write permission in its parent directory. If the -p option is used,
all directories in the path must be empty except for the directory being recursively removed.
EXIT STATUS
The following exit values are returned: Each directory specified by directory operand was successfully removed. An error occurred.
EXAMPLES
To empty and remove a directory, enter: rm mydir/* mydir/.* rmdir mydir
This removes the contents of mydir, then removes the empty directory. The rm command displays an error message about trying to
remove the directories . (dot) and .. (dot dot), and then rmdir removes them.
Note that rm mydir/* mydir/.* first removes files with names that do not begin with a (dot), then those with names that do begin
with a (dot). You may not realize that the directory contains file names that begin with a (dot) because the ls command does not
normally list them unless you use the -a option to see the files whose names begin with a (dot). To remove all of the directories
in the path name a/b/c, enter: rmdir -p a/b/c
Use a command like this one if directory a in the current directory is empty except that it contains a directory b and a/b is empty
except that it contains a directory c.
ENVIRONMENT VARIABLES
The following environment variables affect the execution of rmdir: Provides a default value for the internationalization variables that are
unset or null. If LANG is unset or null, the corresponding value from the default locale is used. If any of the internationalization vari-
ables contain an invalid setting, the utility behaves as if none of the variables had been defined. If set to a non-empty string value,
overrides the values of all the other internationalization variables. Determines the locale for the interpretation of sequences of bytes
of text data as characters (for example, single-byte as opposed to multibyte characters in arguments). Determines the locale for the for-
mat and contents of diagnostic messages written to standard error. Determines the location of message catalogues for the processing of
LC_MESSAGES.
SEE ALSO
Commands: mkdir(1), ls(1), rm(1)
Functions: rmdir(2), unlink(2), remove(3)
Standards: standards(5)
rmdir(1)