There is a list of folders:
2014-12-17 2014-12-21 2014-12-22 2014-12-23 2015-01-13 2015-01-14 2015-01-15 2015-01-16 2015-01-17
How to delete all folders and their contents, which names begin with "2014"? Thank.
as written in man bash
, the EXPANSION section, the Pathname Expansion subsection , the Pattern Matching subtitle, the * character can be used instead of any number of characters when referring to files / directories.
in the appendix to your question, “mask” 2014*
will “select” only those files / directories whose name contains 2014
and then any number of characters :
$ ls -d 2014* 2014-12-17 2014-12-21 2014-12-22 2014-12-23
and to delete (non-empty) directories, use the command rm -r имя-каталога
:
$ rm -r 2014*
man rm
what this means) - “taking care of the user so as not to hurt himself”. To avoid using an alias at startup, you can add a backslash before rm
: \rm -r 2014*
. - aleksandr barakinSource: https://ru.stackoverflow.com/questions/499940/
All Articles
rm 2014* -rf
, but only carefully - KoVadimrm 2014 * -rf
- will remove a bit more. - KoVadim 4:21 pmrm -rf что_нибудь
should always be at least 2 times to think what this command will delete before clicking <Enter>. - andy.37