11-17-2005
Remove non empty dirctory
Hi, Any command or means to delete a director which is not empty
rmdir or similar
iam using Sun Solaries 2.6
I have many full directories with subdirectories and I can not go on emptying them all
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I need to delete an empty directory in a temp directory except "dir5" (keep everything that is not empty).
Plese advise.
Here is an example of my directory.
/dir/temp/
dir1 - delete if this is empty
dir2 - delete if this is empty
dir3 - delete if this is empty
dir4 - delete if this... (7 Replies)
Discussion started by: sirrtuan
7 Replies
2. UNIX for Dummies Questions & Answers
I know this one was answered before in forum below -
https://www.unix.com/unix-dummies-questions-answers/58210-removing-empty-folders-using-find-command.html
But that one is closed & I have a question so here it goes.
I want to delete all 2006 files. Now if along with the files, if the... (2 Replies)
Discussion started by: kedar.mehta
2 Replies
3. Shell Programming and Scripting
Hello:
I searched here for "vi -c" but found no hits.
How can I use vi -c to remove ALL empty lines, regardless of how many?
I tried
<code>
vi -c ":g/^$/d | wq" filename
</code>
but I have to run it several times.
This is NOT homework. :)
Thanks for your time. (3 Replies)
Discussion started by: Habitual
3 Replies
4. Shell Programming and Scripting
3
10 20
10 100
100 10000
Output:
3
10 20
10 100
100 10000
---------- Post updated at 07:59 AM ---------- Previous update was at 07:56 AM ----------
sed '/^$/d' file doesn't work. (8 Replies)
Discussion started by: cola
8 Replies
5. Shell Programming and Scripting
Hi all,
I'm trying to remove when this condition is met: an empty and the next one
I'm using this command:
sed '/^$/N; s/&//' file
Which searches for an empty line, N attaches it to the next line, and substituing the combination with nothing.... but it is not working.
What I'm missing... (1 Reply)
Discussion started by: meuser
1 Replies
6. Shell Programming and Scripting
Hi All,
Can anyone please write a shell script to remove the empty files using an if condition.
please help me out , urgent
thanks (6 Replies)
Discussion started by: muthi_murali
6 Replies
7. UNIX for Dummies Questions & Answers
Hi all !
I'm sure it is a basic question but I didn't find any threads that fit my need.
How to remove empty fields with awk?
Or in other words, how to shift all the fields after an empty field on the left?
input:
1|2||3|4|5||6
wanted:
1|2|3|4|5|6
I tried:
awk '{for(i=1; i<=NF;... (7 Replies)
Discussion started by: lucasvs
7 Replies
8. Shell Programming and Scripting
Hello:
Is there a simple way to remove empty records of FASTA format file?
A FASTA format consists of two parts: header and sequence (for non-biologist, Wiki for details of course!). The header always start with ">" for the name of the sequence. The header must be in this ONLY single line.... (9 Replies)
Discussion started by: yifangt
9 Replies
9. Shell Programming and Scripting
Dear community,
I have two output files that contains some CR
# cat first.out
1234567890 598679857648566 9
1234567234 365837465873465 4
2342343243 289374982374894 4
# cat second.out
2342342342 ... (2 Replies)
Discussion started by: Lord Spectre
2 Replies
10. Shell Programming and Scripting
Hi gurus,
I have a script which works fine.
https://www.unix.com/shell-programming-and-scripting/239347-how-pass-string-into-sql-query.html
while read p
do
&& para="'${p}'" || para="${para},'${p}'"
done < filePlease use code tags as required by forum rules!
a few days... (6 Replies)
Discussion started by: ken6503
6 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)