How to delete multiple files at once in Bash on Linux?

Bash supports all sorts of wildcards and expansions. Your exact case would be handled by brace expansion, like so: $ rm -rf abc.log.2012-03-{14,27,28} The above would expand to a single command with all three arguments, and be equivalent to typing: $ rm -rf abc.log.2012-03-14 abc.log.2012-03-27 abc.log.2012-03-28 It’s important to note that this expansion is done … Read more

How to remove folders with a certain name

If the target directory is empty, use find, filter with only directories, filter by name, execute rmdir: find . -type d -name a -exec rmdir {} \; If you want to recursively delete its contents, replace -exec rmdir {} \; with -delete or -prune -exec rm -rf {} \;. Other answers include details about these … Read more

Remove all files except some from a directory

find [path] -type f -not -name ‘textfile.txt’ -not -name ‘backup.tar.gz’ -delete If you don’t specify -type f find will also list directories, which you may not want. Or a more general solution using the very useful combination find | xargs: find [path] -type f -not -name ‘EXPR’ -print0 | xargs -0 rm — for example, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)