How to CREATEFOLDER then SetAttr to readonly

How would I set every folder created by these commands to read-only?
A dozen attempts to put it all in one line didn't work.
And doing this gives an unterminated string constant error...

cmd.RunCommand('Copy CREATEFOLDER "C:\\catalog\\' + srcLabel + '" FILTER="Folders Only"');
cmd.RunCommand('SetAttr "C:\\catalog\\' + srcLabel + '" r RECURSE'");

Try replacing the second command with this

cmd.RunCommand('SetAttr "C:\\catalog\\' + srcLabel + '" SETATTR r RECURSE FILTER="Folders Only"');

The "unterminated string" error is because the last two quotes are the wrong way around.

Thanks! It works!

But as you warned me back in 2019 (I think) the folders are not "locked", per se and can still be deleted.
(to reiterate my problem - I use these empty folders to act as a catalog of my off-line drives. Something is regularly deleting empty folders from my drives, and I still haven't determined which app it could be. This never happens to folders which contain even the smallest file)

So back to square one.

Let's say I wanted to take every selected folder name (and their child folders recursively) and create zero size files instead.

I'm pretty sure I saw a post about creating such files recently but I can't find it now.

Do I need to use Node/AHK/Python or can DOpus do this?

You can use file permissions instead of the read-only attribute if you want to stop things being deleted.

Making it so only elevated processes/accounts can modify/delete the files is often good, since it means you can still make changes fairly easily but most software, and you most of the time, cannot do it by accident. (Assuming UAC is being used normally, of course.)

For files + folders: Paste empty file list

For just the folders: Recreate Empty Directory Structure

But that is a separate topic, so please start a new thread if you want more help in that direction.