I use Dreamweaver to upload the web page to my site, it bring a folder called _note to everywhere in my site. I would like to ask how can I loop in the directory(/home/user/htdocs) to find the folder _note and delete it?

2 Answers 2


Assuming you have a shell on the webserver, this command would do it:

find /home/user/htdocs -type d -name _note -exec rm -rfv "{}" \;

However I would be more careful then that. I would start by doing this to get a list and make sure its good:

find /home/user/htdocs -type d -name _note -exec echo "'{}'" \; > file.txt

Then review the file and if its all good:

cat file.txt | xargs rm -fvr 

That way you can catch errors before you delete critical files.

  • Very useful of the information, btw what is "{}" in the command line? Apr 18, 2011 at 4:51
  • the {} puts each result of the find command in the command you are running with the -exec flag. So in the first example, I search for all directories named _note and then execute the command rm -rfv the directory name. I add quotes, so that if you have a directory like: Files / Folders ... it does not try to remove /.
    – n8whnp
    Apr 18, 2011 at 5:31

You can use lftp with rm -r to recursively remove a folder/file pattern/name. I think there is command line version of lftp for Windows that you can download and install.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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