Copy sequential folder with increment

Hello :slight_smile:

Everyday i need to copy and paste many times a template folder containing numerous files for many tasks.

Each new folders have incremental in this manner:

1512_72up_051214
1513_72up_051214
1514_72up_051214

Everytimes i need to add news folders for new jobs i need to copy and paste many times the last folder (1514_72up_051214) and then manually rename each new folders to get my increment and remove the words " - copy "

1512_72up_051214
1513_72up_051214
1514_72up_051214
1514_72up_051214 - Copy
1514_72up_051214 - Copy (2)
1514_72up_051214 - Copy (3)
1514_72up_051214 - Copy (4)
1514_72up_051214 - Copy (5)
1514_72up_051214 - Copy (6)

I tried the rename presets but without success. How can i do a rename command to get this result?

1512_72up_051214
1513_72up_051214
1514_72up_051214
1515_72up_051214
1516_72up_051214
1517_72up_051214
1518_72up_051214
1519_72up_051214
1520_72up_051214

Ultimately i wish to be able to modify the last numbers of the folder name to get this result:

1512_72up_051214
1513_72up_051214
1514_72up_051214
1515_72up_051614
1516_72up_051614
1517_72up_051614
1518_72up_051614
1519_72up_051614
1520_72up_051614

Hope someone can give me clues how to do these operations!

Thanks :grin:

So it sounds like you want to either create a new empty folder, or copy an existing one and rename it, using the last folder in the sequence (or the selected folder) as a template, and increment the first number sequence. Is that correct?

Sorry for my english,

I dont want to create a new empty folder. Yes i want to copy an existing folder whatever is empty or populated with files.

I mean i will select one of the existing folders and then copy paste it numerous times.
In my example i have chosen 1514_72up_051214 because i already worked with previous folders and this is my next folder with the files inside remain intact (not modified)

Hello MrC :slight_smile:

I read again carefully your post and i confirm it is correct.

If it is possible to rename the files inside the template folder that can be great too!

Sorry, been a bit busy here.

How are the files inside going to be renamed? Give some examples maybe.

The files inside have the exact folder name.
As example if my folder is about to be renamed as 1520_72up_051614 i need the files inside to be renamed with the same name for each kind of files (.xls .aep)

1520_72up_051614.aep
1520_72up_051614.xls

Sorry been busy since last week...

I have made some experiment.

I created a new button and simply choose a function called Duplicate.

I simply select my folder named 1527_72up_051914
then press my new Duplicate button and a requester appear and asking for a new name.
I use a simple wildcard pattern to paste and rename the duplicated folder like this:

Old name: 1527*
New name: 1528*

Now i get a duplicated folder named like this: 1528_72up_051914

This is what i want but i wish to get more than just one folder at a time. As many i need...

Anyone else have some idea?

:bulb:

Some environments make what should be simple problems very hard. Someone is going to have to write you a script to do this, which repeatedly lists of directory contents to find the latest index pattern you want, and recursively copy the contents of a folder and rename it and its contents.

This is how I'd do it in Unix/LInux environments.

Here's a directory listing:

[code]$ ls -lR
.:
total 8
drwx------+ 1 MrC None 0 May 25 12:49 1512_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1513_72up_051214

./1512_72up_051214:
total 0
-rwx------+ 1 MrC None 0 May 13 09:24 1512_72up_051214.pdf
-rwx------+ 1 MrC None 0 Apr 18 09:09 1512_72up_051214.txt
-rwx------+ 1 MrC None 0 Apr 18 09:09 1512_72up_051214.xls

./1513_72up_051214:
total 0
-rwx------+ 1 MrC None 0 May 13 09:24 1513_72up_051214.pdf
-rwx------+ 1 MrC None 0 Apr 18 09:09 1513_72up_051214.txt
-rwx------+ 1 MrC None 0 Apr 18 09:09 1513_72up_051214.xls[/code]

Now here's the command line that does what you want:

$ i=0; while (( i < 10 )) ; do val=$(ls -1 | egrep -o '^[0-9]*' | tail -1); ((nval=val+1)); tar -cf - ${val}* | tar  --transform s,$val,$nval,g  -xvf -; (( i++ )) ; done

And here are the results:

[code]$ ls -lR
.:
total 48
drwx------+ 1 MrC None 0 May 25 12:49 1512_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1513_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1514_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1515_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1516_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1517_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1518_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1519_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1520_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1521_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1522_72up_051214
drwx------+ 1 MrC None 0 May 25 12:49 1523_72up_051214

./1512_72up_051214:
total 0
-rwx------+ 1 MrC None 0 May 13 09:24 1512_72up_051214.pdf
-rwx------+ 1 MrC None 0 Apr 18 09:09 1512_72up_051214.txt
-rwx------+ 1 MrC None 0 Apr 18 09:09 1512_72up_051214.xls

./1513_72up_051214:
total 0
-rwx------+ 1 MrC None 0 May 13 09:24 1513_72up_051214.pdf
-rwx------+ 1 MrC None 0 Apr 18 09:09 1513_72up_051214.txt
-rwx------+ 1 MrC None 0 Apr 18 09:09 1513_72up_051214.xls

./1514_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1514_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1514_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1514_72up_051214.xls

./1515_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1515_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1515_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1515_72up_051214.xls

./1516_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1516_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1516_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1516_72up_051214.xls

./1517_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1517_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1517_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1517_72up_051214.xls

./1518_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1518_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1518_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1518_72up_051214.xls

./1519_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1519_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1519_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1519_72up_051214.xls

./1520_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1520_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1520_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1520_72up_051214.xls

./1521_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1521_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1521_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1521_72up_051214.xls

./1522_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1522_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1522_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1522_72up_051214.xls

./1523_72up_051214:
total 0
-rwx------ 1 MrC None 0 May 13 09:24 1523_72up_051214.pdf
-rwx------ 1 MrC None 0 Apr 18 09:09 1523_72up_051214.txt
-rwx------ 1 MrC None 0 Apr 18 09:09 1523_72up_051214.xls[/code]

With the one-liner placed in a file, and parameterized, you would call it with the number of new directories you want, like:

$ copyinc 10

You could even pass a pattern into the script, so that it is more flexible.

Probably the easiest way in DOpus will be to COPY the folder, and then rename it and its contents.

Nice!

I'm in a big rush today, i will try these script asap :wink:

Will be back with some news about it..

Thanks a lot!

Pag - its not a "script" you can just use in DOpus. This is a Unix/Linux bash script which calls upon a couple of other tools (egrep, tail, and Gnu tar).

Now, if you had the Cygwin environment installed, you could create a bash script from the above code, and then call it from DOpus.

I don't waste much time writing specialized scripts in a command-line utility-anemic environment like Windows, and instead use tools that are cross-platform and have stood the test of time. *nix systems are so rich this way, that I routinely install Cygwin on any Windows systems I use, as it makes stuff like this really quite trivial. I don't believe in resolving problems that already have really good solutions. :slight_smile:

I have installed Cygwin and It is working!!!

Thanks! it's awesome to see 10 folders generating on the fly with every names ok :slight_smile:
Now i need to know how to call my bash script from Opus...

This is actually where i am in my work in progress to get this working inside Opus:

First step:
I have copy and paste your linux commands to a new text document with notepad and save this notepad document as 10-Clones.txt

$ i=0; while (( i < 10 )) ; do val=$(ls -1 | egrep -o '^[0-9]' | tail -1); ((nval=val+1)); tar -cf - ${val} | tar --transform s,$val,$nval,g -xvf -; (( i++ )) ; done

Next to test if Cygwin is responding to commands i open the windows shell cmd.exe and type this:
cd with the path to my folder where 10-Clones.txt reside.

cd E:\0000-Linux_BASH

then i just type the command bash like this: bash 10-Clones.txt

To there everything work as expected!

Now i am to figure out how to implement this in a button in Opus..
I know how to create a button and add some Opus internal command but this time i need to as Opus to run a script outside Opus and i don't know how to do this... :unamused:

It is by using internal Cli command?

Ok i get a better result now,

Now i understand how to input MS-DOS Batch function.
So i created a button and put these commands:

cd E:\0000-Linux_BASH\

bash 10-Clones.txt

This is work perfectly in my test folder where i only put two folders plus other folders sorted alphabetically to do the tests:

1551_72up_060414
1552_72up_060414
aLL.aep Logs
Demo
Photo_Quality_Status
System Volume Information
Template_48UP
Test

When i click on my new button i get the result i expect even my last folder is selected or not and even there are other folder after my last incremented folder (1552_72up_060414)

1551_72up_060214
1552_72up_060214
1553_72up_060214
1554_72up_060214
1555_72up_060214
1556_72up_060214
1557_72up_060214
1558_72up_060214
1559_72up_060214
1560_72up_060214
1561_72up_060214
1562_72up_060214
aLL.aep Logs
Demo
Photo_Quality_Status
System Volume Information
Template_48UP
Test

  • Now in the real situation where i work inside my real production folder there are numerous other similar folders with other incremental numbers but before my last folder..

844_132up_091112_Tester
1490_RUSH_010514
1549_72up_052714
1550_72up_052714
1551_72up_060214
1552_72up_060214
aLL.aep Logs
Demo
Photo_Quality_Status
System Volume Information
Template_48UP
Test

-Now when i click on my button i get a very different result and this is now a problem because of the result...

844_132up_091112_Tester
845_132up_091112_Tester
846_132up_091112_Tester
847_132up_091112_Tester
848_132up_091112_Tester
849_132up_091112_Tester
850_132up_091112_Tester
851_132up_091112_Tester
852_132up_091112_Tester
853_132up_091112_Tester
854_132up_091112_Tester
1490_RUSH_010514
1549_72up_052714
1550_72up_052714
1551_72up_060214
1552_72up_060214
aLL.aep Logs
Demo
Photo_Quality_Status
System Volume Information
Template_48UP
Test

How can i instruct the linux script to detect the last incremented folder (1552_72up_060214) to do the replication well done?

Thanks :slight_smile:

What you need should be easy enough to do with a script in Opus. I don't know why this thread has crossed over to talking about using Linux/Cygwin, but that's making things a lot more complicated (and off-topic for this forum).

If you link your account I can help you solve this with an Opus script.

I helped Pag because he asked for help.

I don't see the Cygwin tools as any different than, say, BeyondCompare, or any other external, 3rd party tool you use, recommend, and have written interfaces for. It's just another tool or toolset.

I thought the goal here is to help people use DOpus to get their jobs done, and the choice of tools, and how they interface with DOpus is entirely up to them.

It makes sense to use an external tool if it's not something you can do in Opus/Windows on its own, and using the external tool lets you do things in a much better or easier way.

But this is something a little bit of JScript or VBScript could do. There are lots of downsides to using Cygwin and the only upside is that you are familiar with it.

I'm sure the OP will be thrilled to get your script.

Your argument is specious, however.

Hi Leo,

Thanks for your help :slight_smile:

I just linked my account..

What do i have to do next?

Also thanks MrC!!!
I think leo is the OP :wink:

Here's a video showing what the button does:

Select the last folder (the one you want to duplicate), and then click the button. It will ask you how many copies you want made and then make them.

Duplicate folders are named using the incremented number of the selected folder (and then one more each time), plus whatever is in the middle of the selected folder name, plus today's date in MMDDYY format at the end.

The script will check that there aren't already any folders with a higher number than the selected folder, and warn you if there are. (You can choose whether to continue or not when that happens.)

Once all the duplicates are created, they will be selected, so you can see what was done.

--

Here's the script itself, just for reference. Most of the logic is error checking to try to avoid making a mess if something unexpected is selected.

[code]option explicit

Function ZeroPad(str, slen)
str = CStr(Str) ' Force To String.
If (Len(str) < slen) Then
str = String(slen - Len(str), "0") & str
End If
ZeroPad = str
End Function

Function IsLongInteger(str)
IsLongInteger = False
If (IsNumeric(str)) Then
' Not really needed, but make sure the number doesn't have a decimal point.
If (CStr(CLng(str)) = CStr(str)) Then
IsLongInteger = True
End If
End If
End Function

Function OnClick(ClickData)
Dim dlgTitle, tab, dlg, cmd, numFolders, regexp, matches
Dim fullName, namePrefix, nameSuffix, prefixLen, nowDate, i
Dim fsu, folderEnum, currentPrefix
dlgTitle = "Duplicate template folder"
nowDate = Date()
Set tab = Clickdata.func.sourcetab
Set dlg = ClickData.func.Dlg
Set cmd = ClickData.func.command
Set regexp = New RegExp
Set fsu = DOpus.FSUtil

cmd.deselect = False

' Check exactly one folder is selected.

If (tab.selected_dirs.count <> 1 Or tab.selected_files.count <> 0) Then
	dlg.Request "Select one folder to duplicate.", "OK", dlgTitle
	Exit Function
End If

' Split the folder name up and put today's date on the end.

regexp.IgnoreCase = True
regexp.Global = True
regexp.Pattern = "^(\d+)(_.+_)\d{6}$"
Set matches = regexp.Execute(tab.selected_dirs(0).name)
If (matches.count < 1) Then
	dlg.Request "Selected folder's name does not fit the expected pattern.", "OK", dlgTitle
	Exit Function
End If

namePrefix = matches(0).SubMatches(0)
nameSuffix = matches(0).SubMatches(1)

prefixLen = Len(namePrefix)
namePrefix = CLng(namePrefix)

nameSuffix = nameSuffix & ZeroPad(Month(nowDate),2) & ZeroPad(Day(nowDate),2) & ZeroPad(Right(Year(nowDate),2),2)

' Ask how many copies to make.

dlg.Select = True
dlg.default = "1" ' Default number of folders to create
dlg.max = 4 ' Max string length. More than 9999 folders would probably be a mistake.
dlg.buttons = "OK|Cancel"
dlg.message = "How many new folders are needed?"
dlg.title = dlgTitle
If (dlg.Show() <> 1) Then
	Exit Function ' Cancelled
End If
numFolders = dlg.Input

If (Not IsLongInteger(numFolders)) Then
	dlg.Request "Invalid number of folders entered.", "OK", dlgTitle
	Exit Function
End If

numFolders = CLng(numFolders)

' Warn if any prefix numbers in the range we are about to create are already in use.

Set folderEnum = fsu.ReadDir(Clickdata.func.sourcetab.path, False)
Do While Not folderEnum.Complete
	Set matches = regexp.Execute(folderEnum.Next.name)
	If (matches.count > 0) Then
		currentPrefix = CLng(matches(0).SubMatches(0))
		If (currentPrefix >= (namePrefix + 1)) Then
			If (dlg.Request("Folders already exist with prefix " & (namePrefix + 1) & " or above." & vbCrLf & "Are you sure you wish to continue?", "Continue|Cancel", dlgTitle) <> 1) Then
				Exit Function
			End If
			Exit Do
		End If
	End If
Loop

' Create the duplicate folders

currentPrefix = namePrefix

For i = 1 To numFolders
	currentPrefix = currentPrefix + 1
	fullName = ZeroPad(currentPrefix, prefixLen) & nameSuffix
	cmd.RunCommand "Copy DUPLICATE HERE AS=""" & fullName & """"
Next

' Select what was created

cmd.RunCommand "Select NONE"

currentPrefix = namePrefix

For i = 1 To numFolders
	currentPrefix = currentPrefix + 1
	fullName = ZeroPad(currentPrefix, prefixLen) & nameSuffix
	cmd.RunCommand "Select MAKEVISIBLE EXACT PATTERN=""" & fullName & """"
Next

End Function[/code]

Here's the button in XML format, ready to paste to your toolbar.

See How to add buttons from this forum to your toolbars, specifically the second part that talks about XML button definitions.

<?xml version="1.0"?> <button backcol="none" display="both" label_pos="right" textcol="none"> <label>Duplicate Template Folder</label> <icon1>#default:newcollection</icon1> <function type="script"> <instruction>option explicit</instruction> <instruction /> <instruction>Function ZeroPad(str, slen)</instruction> <instruction> str = CStr(Str) &apos; Force To String.</instruction> <instruction> If (Len(str) &lt; slen) Then</instruction> <instruction> str = String(slen - Len(str), &quot;0&quot;) &amp; str</instruction> <instruction> End If</instruction> <instruction> ZeroPad = str</instruction> <instruction>End Function</instruction> <instruction /> <instruction>Function IsLongInteger(str)</instruction> <instruction> IsLongInteger = False</instruction> <instruction> If (IsNumeric(str)) Then</instruction> <instruction> &apos; Not really needed, but make sure the number doesn&apos;t have a decimal point.</instruction> <instruction> If (CStr(CLng(str)) = CStr(str)) Then</instruction> <instruction> IsLongInteger = True</instruction> <instruction> End If</instruction> <instruction> End If</instruction> <instruction>End Function</instruction> <instruction /> <instruction>Function OnClick(ClickData)</instruction> <instruction> Dim dlgTitle, tab, dlg, cmd, numFolders, regexp, matches</instruction> <instruction> Dim fullName, namePrefix, nameSuffix, prefixLen, nowDate, i</instruction> <instruction> Dim fsu, folderEnum, currentPrefix</instruction> <instruction> dlgTitle = &quot;Duplicate template folder&quot;</instruction> <instruction> nowDate = Date()</instruction> <instruction> Set tab = Clickdata.func.sourcetab</instruction> <instruction> Set dlg = ClickData.func.Dlg</instruction> <instruction> Set cmd = ClickData.func.command</instruction> <instruction> Set regexp = New RegExp</instruction> <instruction> Set fsu = DOpus.FSUtil</instruction> <instruction /> <instruction> cmd.deselect = False</instruction> <instruction /> <instruction> &apos; Check exactly one folder is selected.</instruction> <instruction /> <instruction> If (tab.selected_dirs.count &lt;&gt; 1 Or tab.selected_files.count &lt;&gt; 0) Then</instruction> <instruction> dlg.Request &quot;Select one folder to duplicate.&quot;, &quot;OK&quot;, dlgTitle</instruction> <instruction> Exit Function</instruction> <instruction> End If</instruction> <instruction /> <instruction> &apos; Split the folder name up and put today&apos;s date on the end.</instruction> <instruction /> <instruction> regexp.IgnoreCase = True</instruction> <instruction> regexp.Global = True</instruction> <instruction> regexp.Pattern = &quot;^(\d+)(_.+_)\d{6}$&quot;</instruction> <instruction> Set matches = regexp.Execute(tab.selected_dirs(0).name)</instruction> <instruction> If (matches.count &lt; 1) Then</instruction> <instruction> dlg.Request &quot;Selected folder&apos;s name does not fit the expected pattern.&quot;, &quot;OK&quot;, dlgTitle</instruction> <instruction> Exit Function</instruction> <instruction> End If</instruction> <instruction /> <instruction> namePrefix = matches(0).SubMatches(0)</instruction> <instruction> nameSuffix = matches(0).SubMatches(1)</instruction> <instruction /> <instruction> prefixLen = Len(namePrefix)</instruction> <instruction> namePrefix = CLng(namePrefix)</instruction> <instruction /> <instruction> nameSuffix = nameSuffix &amp; ZeroPad(Month(nowDate),2) &amp; ZeroPad(Day(nowDate),2) &amp; ZeroPad(Right(Year(nowDate),2),2)</instruction> <instruction /> <instruction> &apos; Ask how many copies to make.</instruction> <instruction /> <instruction> dlg.Select = True</instruction> <instruction> dlg.default = &quot;1&quot; &apos; Default number of folders to create</instruction> <instruction> dlg.max = 4 &apos; Max string length. More than 9999 folders would probably be a mistake.</instruction> <instruction> dlg.buttons = &quot;OK|Cancel&quot;</instruction> <instruction> dlg.message = &quot;How many new folders are needed?&quot;</instruction> <instruction> dlg.title = dlgTitle</instruction> <instruction> If (dlg.Show() &lt;&gt; 1) Then</instruction> <instruction> Exit Function &apos; Cancelled</instruction> <instruction> End If</instruction> <instruction> numFolders = dlg.Input</instruction> <instruction /> <instruction> If (Not IsLongInteger(numFolders)) Then</instruction> <instruction> dlg.Request &quot;Invalid number of folders entered.&quot;, &quot;OK&quot;, dlgTitle</instruction> <instruction> Exit Function</instruction> <instruction> End If</instruction> <instruction /> <instruction> numFolders = CLng(numFolders)</instruction> <instruction /> <instruction> &apos; Warn if any prefix numbers in the range we are about to create are already in use.</instruction> <instruction> </instruction> <instruction> Set folderEnum = fsu.ReadDir(Clickdata.func.sourcetab.path, False)</instruction> <instruction> Do While Not folderEnum.Complete</instruction> <instruction> Set matches = regexp.Execute(folderEnum.Next.name)</instruction> <instruction> If (matches.count &gt; 0) Then</instruction> <instruction> currentPrefix = CLng(matches(0).SubMatches(0))</instruction> <instruction> If (currentPrefix &gt;= (namePrefix + 1)) Then</instruction> <instruction> If (dlg.Request(&quot;Folders already exist with prefix &quot; &amp; (namePrefix + 1) &amp; &quot; or above.&quot; &amp; vbCrLf &amp; &quot;Are you sure you wish to continue?&quot;, &quot;Continue|Cancel&quot;, dlgTitle) &lt;&gt; 1) Then</instruction> <instruction> Exit Function</instruction> <instruction> End If</instruction> <instruction> Exit Do</instruction> <instruction> End If</instruction> <instruction> End If</instruction> <instruction> Loop</instruction> <instruction /> <instruction> &apos; Create the duplicate folders</instruction> <instruction /> <instruction> currentPrefix = namePrefix</instruction> <instruction /> <instruction> For i = 1 To numFolders</instruction> <instruction> currentPrefix = currentPrefix + 1</instruction> <instruction> fullName = ZeroPad(currentPrefix, prefixLen) &amp; nameSuffix</instruction> <instruction> cmd.RunCommand &quot;Copy DUPLICATE HERE AS=&quot;&quot;&quot; &amp; fullName &amp; &quot;&quot;&quot;&quot;</instruction> <instruction> Next</instruction> <instruction /> <instruction> &apos; Select what was created</instruction> <instruction /> <instruction> cmd.RunCommand &quot;Select NONE&quot;</instruction> <instruction /> <instruction> currentPrefix = namePrefix</instruction> <instruction /> <instruction> For i = 1 To numFolders</instruction> <instruction> currentPrefix = currentPrefix + 1</instruction> <instruction> fullName = ZeroPad(currentPrefix, prefixLen) &amp; nameSuffix</instruction> <instruction> cmd.RunCommand &quot;Select MAKEVISIBLE EXACT PATTERN=&quot;&quot;&quot; &amp; fullName &amp; &quot;&quot;&quot;&quot;</instruction> <instruction> Next</instruction> <instruction /> <instruction>End Function</instruction> </function> </button>