I am pretty new to scripting, so I appreciate your advice in advance.
The problem:
100 directories each containing 2 files that have the same extension with random names. The only attribute that discriminates the files is size. I would like to write a script that compares the files for size and deletes the smaller of the two. Thanks! - OSX, X11, bash
The file names are random. The extension is the same (that is probably windows talk - sorry). I want the script to look in each directory and delete the smaller of the two files.
e.g.,
Thank you so much! I'm embarrassed to say I've been struggling with that for 2 days. (I have a hard time asking for help ). On the whole the script is beyond my vocabulary, but could you say how you actually made the size comparison here and how you got that output to "$1" and "$2".
It would probably be better to omit the quotes. The reason I say that is because no quotes makes it clear that the approach isn't intended to handle whitespace and pattern matching characters. As is, casual inspection may instill a false sense of security. Whatever those quotes protect against in the subshell will just bite in the parent shell.