bash - loop; passing two argument - 1:1 mapping -
if have 50 different files rename (or anything, 2 arguments). how loop or other method ?
mv $1 $2
i dont want pass argument each instance. $1 = ab
, $2 = 1
. 50 differnt filenames.
say have list of txt files in current directory want rename:
for f in *.txt; mv "$f" "renamed_$f"; done
i suggest adding echo
after see how command execute first, , removing echo if looks good.
for common file renaming tasks might want consider using mmv
allows pattern-based file renaming more easily.
Comments
Post a Comment