目标:
copy all files .pdf to _0.pdf
推荐使用rename.ul或mmv
1. rename.ul
1 | rename.ul -v -n ".pdf" "_0.pdf" *.pdf |
2. bash
1 | for f in *.pdf; do pre="${f%.pdf}"; echo mv -- "$f" "${pre}_0.pdf"; done |
3. rename
1 | rename -n 's/\.pdf$/_0$&/' *.pdf |
matches .pdf at the end of the filename
1 2. in the replacement, the match is prepended by ```_0```: ```_0$&
- drop -n for actual action
4. mmv
1 | sudo apt-get install mmv |