Jump to content
Macro Express Forums

Create A New Directory With A Variable In The Name


Recommended Posts

I'm attempting to create a macro that will move files from one directory, and archive them in another directory. Every time the macro runs, I want it to create a directory named after the curent month/day/year/hour:min and then move all the files from the source directory into the newly created directory. The trouble that I'm having is that I'm using the create folder command like this


Create Folder: "f:\archive\%N1%"


All I get when that runs, is a directory named %N1% under the archive folder. The variable is not being replaced. Any idea how to make this work?

Link to comment
Share on other sites

Welcome to the group!


You first need to set a variable with the current date/time:


Date/Time: Save "yyyymmdd.hh.mm" into %T1%
Create Folder: "c:\temp\%T1%"

And don't forget there are characters that cannot be used in a folder or file name. \ / : * ? " < > |

Link to comment
Share on other sites

Wow, thanks man you rock! Now I wanna have the macro delete any directory, and all it's sub-directories under f:\archive that are over 30 days old. I'm archiving pictures from a motion sensing webcam, and I don't wanna keep any pics over 30 days old. I'm banging my head against it now, but any suggestions would be appreciated.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...