Archive: Rename command


Rename command
Hi, I am trying to rename a directory using the rename command, but to my surprise it doesn't always work. I will say it does not work 50% of the time.

rename "$INSTDIR\Database\*.*" "$INSTDIR\Db_${__TIMESTAMP__}\*.*"

I need some help pls.


From your command it seems like you're trying to move all the files from $INSTDIR\Database to $INSTDIR\Db_${__TIMESTAMP__}. However, Rename doesn't support wildcards and from your post, it sounds like you want to move the entire directory, not the files in it. Instead, you should use:

Rename "$INSTDIR\Database" "$INSTDIR\Db_${__TIMESTAMP__}"
Also, ${__TIMESTAMP__} is what you want there. This symbol is translated to the last edit time of the script. It's not the time on the user's computer. This may also cause the Rename command to fail, because the destination must not already exist.