I have a line like this in my script:
rm "$TEMP_DIR/*.txt"
It fails with this output:
rm: cannot remove 'temp/*.txt': No such file or directory
I don't understand why doesn't that work. What am I doing wrong?
I have a line like this in my script:
rm "$TEMP_DIR/*.txt"
It fails with this output:
rm: cannot remove 'temp/*.txt': No such file or directory
I don't understand why doesn't that work. What am I doing wrong?
Because you're using quotes in the command, rm
thinks you want a filename with a literal *
character, it's not expanding that as a wildcard. Try it without the quotes to match all files ending with .txt
instead:
rm "$TEMP_DIR"/*.txt