This question already has an answer here:

How to delete all empty directories starting with 201 ?

The command must not execute recursive.. Only directories in the current directory

find /var/www -type d -name "201*" -exec rm {} \

This returns

find: missing argument to `-exec'

marked as duplicate by steeldriver, Jenny D, roaima, chaos, jimmij Nov 27 '15 at 22:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • You missed the last ;, find /var/www -type d -name "201*" -exec rm {} \; – cuonglm Nov 27 '15 at 13:39
  • have added some info.. the command must not execute recursively.. – clarkk Nov 27 '15 at 13:40
  • use the -maxdepth 1 option for avoiding descending into dirs – Fiximan Nov 27 '15 at 13:47

you can simply run

rmdir 201*/

rmdir will only delete empty directories and 201*/ matches all subdirectories of the current one starting with 201.

if you don't want to change to the respective directory before, you can use the full path:

rmdir /var/www/201*/
  • how do I add the current dir to the command? – clarkk Nov 27 '15 at 13:44
  • I am not a hundred percent sure what you mean. Do you mean the full path to the directory where the 201 directories reside? That would be rmdir /var/www/201*/ – Thawn Nov 27 '15 at 13:46
  • I found out rmdir 201*/ /var/www/current_dir – clarkk Nov 27 '15 at 13:49
  • your solution works too.. both works :) – clarkk Nov 27 '15 at 13:54

Not the answer you're looking for? Browse other questions tagged or ask your own question.