i found this online it copy file to every sub folder on the current dir for full tree depth

find -maxdepth 1 -type d -print0 | xargs -0 -n1 cp -v  .htaccess

now would be nice if it could ask if the file already exist or at least overwrite if file already exists.

Is there way to reverse this command so it can actually remove matching file from every subfolder?

link|improve this question
For confirmation of overwrite, add -i to the cp flags. – DerfK Nov 5 '11 at 9:56
feedback

1 Answer

Find is extremely versatile, the -delete and -name pattern options may helpful for what you want.

find -maxdepth 1 -type f -name '.htaccess' -delete
link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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