17 Jan
2023
17 Jan
'23
00:29
On 1/16/23 02:07, Simon Becherer wrote:
i have to rename hunderts of files: 792041_100029699.mi 792090_100029501.mi . . . to 792041.mi 792090.mi . . .
cd /path/to/dir/with/files for fname in *; do [ -f "$fname" ] || continue # skip everything not a file mv "$fname" "${fname%_*}.mi" done (will work for any advanced or POSIX shell, ash, bash, dash, etc...) -- David C. Rankin, J.D.,P.E.