Skip to content

Commit 9af8c4f

Browse files
Update group-files-by-year.md
1 parent c440191 commit 9af8c4f

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

recipes/shell/group-files-by-year.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,16 @@ done
1818
```
1919

2020
Note the check at the start because in Bash (not ZSH), if `*.md` does not match any files then it uses `'*.md'` as a string literal.
21+
22+
Reverse the above operation:
23+
24+
```sh
25+
#!/bin/bash
26+
27+
set -e
28+
29+
for FILE in */*.md; do
30+
[ -f "$FILE" ] || continue
31+
mv "$FILE" .
32+
done
33+
```

0 commit comments

Comments
 (0)