I found an interesting trick in bash today that may help a few other folks as well. Occasionally I find that need to copy almost every file in a directory, except for one or two. Usually I'd copy everything and then delete the stragglers I didn't want from the destination directory. There had to be a better way, but as I said I'm lazy. Turns out I found the better way today.
[jperrin@ferrata ~]$ cp -r !(file_to_ignore) /destination/
This little trick gets a bit better. Bash is slick enough to understand 'or' in this context. So I can also ignore multiple files if I need to
[jperrin@ferrata ~]$ cp -r !(file_to_ignore| this-one-too) /destination/
Hopefully someone else finds this helpful as well.
More builders available for Koji/CBS
2 months ago