Jump to content
Macro Express Forums

Variable set from folder

Recommended Posts

Hi all,

new to Macro Express Pro so I apologize if the question is stupid.

How can I set variables according to folders properties, the same way i can do with files? (atime, mtime and so on)).

Therre is no Variable Set from Folder, and it seems Variable Set From file is not working with directories (that is not a huge surprise :) ).

Thank you in advance

Link to comment
Share on other sites



No apology necessary! But can you be more specific please. Exactly what operations are you trying to perform on a folder with a macro?

What is 'atime'? 'mtime'? I see no such fields in the Properties dialog, as shown in my screenshot. Do you mean Date Modified, Date Accessed, etc?


What is the distinction you're making between a directory and a folder? Are you referring to folders and subfolders?

From Help > Variable Set from File:

"The Variable Set from File command obtains either the date and time of a specific file or the path of the file and saves the information to variables." (My bold.)


Does the following macro help? (Change test folder to suit.)


Open Folder to "c:\users\Terry\Test"
Variable Set From File date
Text Box Display: Last Accessed info about folder C:\users\Terry\Test



<OPEN FOLDER Path="c:\\users\\Terry\\Test"/>
<VARIABLE SET FROM FILE Filename="C:\\Users\\terry\\Test" Option="\x00" Date="\x02" Month="%nMonth%" Day="%nDay%" Year="%nYear%" Hour="%nHour%" Minutes="%nMin%" Flags="\x1F"/>
<TEXT BOX DISPLAY Title="Last Accessed info about folder C:\\users\\Terry\\Test" Content="{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang2057{\\fonttbl{\\f0\\fnil Tahoma;}{\\f1\\fnil\\fcharset0 Tahoma;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs20 nYear\\f1  = \\f0 %nYear%\r\n\\par nMonth\\f1  = \\f0 %nMonth%\r\n\\par nHour\\f1  = \\f0 %nHour%\r\n\\par nMin\\f1  = \\f0 %nMin%\r\n\\par \r\n\\par }\r\n" Left="821" Top="485" Width="368" Height="158" Monitor="0" OnTop="TRUE" Keep_Focus="TRUE" Mode="\x00" Delay="0"/>



Link to comment
Share on other sites

Hi and thank you for your answer. Atime and Mtime are Access Time and Modification Time as native properties of files and folders in most filesystems (sorry atime and mtime as names are maybe mostly linux stuff). You can easily see these properties setting a custom directory view (using Details listing) in File Explorer, and choosing to show them as custom columns when listing the directory. If you check Variable Set From File, there is the option to check and set variables according to the file time properties, one for Access Time and one for Modification Time. But I am not sure if I can do the same check with folders. The check floders this way is very handy monitoring or scanning a filesystem for changes, for example for backup, archive or versioning macro. When a file is changed within a directory, also the mtime and atime of its directory is changed. This means that if you are scanning a filesystem with 1.000.000 in 100.000 folders to perform any action on the files, you can skip all the folders that have a mtime later than a preconfigured date, making the script by far faster. I hope I was able to explain myself a bit better. Cheers

Link to comment
Share on other sites



Thought I replied an hour ago to your latest, but seems to have vanished. In short:


Did you read the Help extract I highlighted, showing that it does apply to folders?


Did you try the example macro I showed you?


BTW, I assume the answer to my question about folder v directory is the same as the one you gave about 'mtime' etc, namely that you're using Linux?


Link to comment
Share on other sites

1 hour ago, terrypin said:

Hi, sorry for the late answer, I am testing it right now so if it works, great! I will let you know asap. In the meantime I found that the error I got was due to some corrupted files in my directory, not from getting the variables, and I am now going on step by step testing again this first macro (in my spare time). Unfortunately I am not a coder so it's not exactly easy for me. About the SO, no I am on Win 10 working on a NAS (linux) but I was a linux sysadmin (in a far past), so I often use linux terms. About your macro, I am embarrassed but I have no idea of where to start with it... I will let you know my progresses, I am confident I will figure it out, just it takes a lot of time cause I am a rookie :)

Link to comment
Share on other sites

To run any macro posted to you in the form that I did, you you can either:

1. Type the commands into a new macro of your own, but changing anything that needs it. In this case you don’t have a folder called "c:\users\Terry\Test" so create one of your own and enter that instead.

2. Copy the code and paste it into a new macro, then make the same change.




  • Like 1
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...