rodrigosantosbr

[linux] Remove multiple subdirectories with same name

Dec 29th, 2018
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!

suppose you have multiple project directories (proj1, proj2, proj3, ...).
Each of them contains a directory named 'temp'.
Now, the task is to remove all these 'temp' directories in one go. What would you do?

projects
  |-- proj1
        |-- temp
  |-- proj2
        |-- temp
  |-- proj3
        |-- temp
  |-- proj4
        |-- temp
find /home/user/projects -maxdepth 2 -type d -name temp -exec rm -r {} +
Add Comment
Please, Sign In to add comment