How do I delete every little thing in a directory site?

Just how do I delete every little thing in a directory site, consisting of surprise files and also directory sites?

Now, I make use of the following:

rm -rf *
rm -rf .*
0
2019-05-18 23:20:16
Source Share
Answers: 7

Simple and also easy :

find -delete 

Includes directory sites and also surprise documents. At the very least gnu - locate recognizes -delete, your find might vary.

0
2019-12-02 00:50:08
Source

Try rm -rf *?*. This will certainly delete regular and also hidden files.

0
2019-05-21 10:17:27
Source
rm -rf -- * .[!.]* ..?*

Each of the 3 pattern increases to itself if it matches absolutely nothing, yet that is not a trouble below given that we intend to match every little thing and also rm -f overlooked missing debates.

Keep in mind that .*.

0
2019-05-21 10:16:42
Source

if you remain in the directory site:

cd .. && rm -rf dir && mkdir dir && cd dir

or else:

rm -rf /path/to/dir && mkdir /path/to/dir

0
2019-05-21 10:14:39
Source

Oh my Zsh

rm -rf (.|)*

Again, this is for Zsh just.

0
2019-05-21 10:08:47
Source

How around making use of find. I assume this is usually an excellent selection, when you need to dig via below - directory sites.

find . -type f -exec rm {} \;
0
2019-05-21 09:47:09
Source

The ideal solution is: Don't do that. Recursively remove the directory site itself, after that recreate it as a vacant directory site. It is extra trusted and also less complicated for other individuals to recognize what you are attempting to do. When you re - create the directory site it might have a various proprietor, team and also approvals. If those are necessary take care. Additionally, if any kind of running programs have open documents takes care of (descriptors) on the directory site after that you will not intend to remove it. If none of those grandfather clauses use, after that it is less complex to remove the whole directory site.

0
2019-05-21 09:07:35
Source