Greetings,
What began as a simple desire has turned into a couple days of staring at various forums, help websites, man pages, and blogs. I have really, really tried to serve myself and not have to actually start a new thread so if by some chance this has been answered somewhere else my sincere apologies, but I just can't devote any more time to trying to solve this myself and I really need someone to just tell me the answer.
What I'm trying to do with find: I am trying to find *.mp3 files in subdirs named CD* (where the * is a number) and pass the results to the mv command which will then mv said mp3s to the parent directory. I have been able to construct an argument for the first half of this which is:
find . -type d -name 'CD?' -print (I'm just printing to test the output). The issues that I need to guard against are that I already have mp3s in an artist directory and I don't want those just moved into the mp3 directory; I only want the mp3s that are in dirs named CD* to be moved. I have tried find . -type d -name 'CD?' -and -type f -name '*.mp3' -print but nothing happens. I even looked at
http://www.gnu.org/software/findutil...ttern-Matching and tried to do:
find . -name './CD*mp3' -print
but the command line returns nothing - no errors, no suggestions, just as if I hit the enter key without typing a damn thing.
My find does not seem to have the -iwholename or -wholename switch fwiw. This is stemming from an issue that I was not able to solve with rar/unrar. I do not know how to script and while I believe I found a couple scripts that seemed to address my issue, I couldn't understand how to compile the script (my most command line familiarity unfortunately is with DOS, so, what's the *nix equivalent of a .bat file?), so I will ask this question as an addendum...
I had .rar files in my /mp3/ArtistName-AlbumName/CD*/ dirs, and I wanted to just unrar the contents to the parent dir, thus negating the need for the above operation with mv (although at this point I would like to know how to do it for pure and simple edification...). I was able to come up with this:
cd mp3
find . -name "*.rar" -exec rar x {} "../" \;
which I thought would do what I wanted but no dice. Believe me I tried moving those dots and slashes, i.e. "../" in all sorts of permutations to no avail. The best I could do that would get me halfway there and actually put me in a postition to use this other find expression was:
find . -name "*.rar" -execdir unrar e {} \;
which will unrar into the same dir as the archives.
So if anyone could answer one or both of these questions I would be immensely grateful. Thank you.