I am using below line to copy html files from source dir to target dir. How can I rename the files while moving them to 001.html, 002.html, 003.html etc ?
find ${SourceDir} -type f -regex ".*\.\(htm\|html\|xhtm\|xhtml\)" -exec mv {} "${TargetDir}" \;
You could use a counter in a loop and use shell parameter expansion to get the file extension.
The following might work for you:
If your shell doesn't support process substitution, you might say:
Be warned that this might not work if the filenames contain weird characters.