mercredi 26 octobre 2022

CMD to append random suffix to filename of files

I have a list of files and I need to append at the end of filename for each file a random numeric suffix with 5 digits, for example:

"test.txt" rename in "test_XXXXX.txt"

I found this script that it seems for linux, but I need Windows CMD script:

for file in *.txt; do
    mv -- "$file" "$(mktemp --dry-run xxxxx.txt)"
done



Aucun commentaire:

Enregistrer un commentaire