I've been looking for a code snippet to place in a .sh that removes a directory named after a file.
What I mean by this is I would like to move to specify a directory and then search it for a list of files of type ".XXX" and then remove any subdirectories (with contents) with the same name.
Pseudo code of what i want to do:
find names all files of type .XXX within a directory
find and remove all subdirectories with names that equal the file names found
How would one best go about this? I have been looking at the find function, which I will be using before this function to unrar archives:
`find . -name "*.rar" -exec unrar x '{}' \;`