Timeline for How can I copy all files while excluding files with a certain pattern?
Current License: CC BY-SA 4.0
9 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 24, 2022 at 10:35 | comment | added | K-attila- | The cp -av photos/*/!(*.meta).json photos-copy/ is very nice :). Thx. | |
| Feb 23, 2022 at 20:47 | vote | accept | xenon | ||
| Feb 23, 2022 at 20:47 | comment | added | xenon | Oh, you are right! Thanks again for the help! :) | |
| Feb 23, 2022 at 20:46 | comment | added | Chris Davies | Sounds like you're using sh rather than bash. They're different shells | |
| Feb 23, 2022 at 18:38 | comment | added | xenon | That's very cool! I tried the example you had with pattern matching, which I thought is cool, but I'm getting a syntax error: sh: -c: line 0: syntax error near unexpected token ('. Is there something I should take note of when using pattern matching? I have tried with and without the line shopt -s extglob` and I still got that syntax error. | |
| Feb 23, 2022 at 18:07 | comment | added | Chris Davies | @xenon try the extra alternatives I've added | |
| Feb 23, 2022 at 18:07 | history | edited | Chris Davies | CC BY-SA 4.0 | More variations on a theme. I prefer Rachmaninoff's variations though |
| Feb 23, 2022 at 17:15 | comment | added | xenon | Thanks a lot for the cp option! Just one thing, I notice that the files are still copied with their same folder in photos-copy. So, instead of copying to photos-copy/photo-a.json, they are still copied as photos-copy/photo-a/photo-a.json. Is there a way to copy and flatten it by one level to photos-copy/photo-a.json? | |
| Feb 23, 2022 at 17:08 | history | answered | Chris Davies | CC BY-SA 4.0 |