Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to add index to folder name?
#1
Hi,
I have multiple arbitrarily named folders such as
c:$Desktop$\TEST\fwdpsd
c:$Desktop$\TEST\asde
c:$Desktop$\TEST\dewd3sceded
c:$Desktop$\TEST\afefew
and I want to add the number i to the folder name
at the beginning of each folder following the alphabetical order.

For the example above, the folders above should be renamed to
c:$Desktop$\TEST\1_afefew
c:$Desktop$\TEST\2_asde
c:$Desktop$\TEST\3_dewd3sceded
c:$Desktop$\TEST\4_fwdpsd
Code:
Copy      Help
I've tried the following:
int i j=5
for(i 1 j)
,out i
,ren F"$Desktop$\TEST\*.*" F"$Desktop$\TEST\{i}_*.*"
but unfortunately it did not work.

Later I want also to access the folder by only using the numbers, such as
Code:
Copy      Help
int i j=5
for(i 1 j)
,out i
,str fileName.expandpath(F"$Desktop$\TEST\{i}_*.*\{i}")
,run "Notepad.exe" """""" 0x2800 win("Untitled - Notepad" "Notepad")
,'A{fa}            ;; Alt
,wait(5 win("Save As" "#32770"))
,'(fileName) Y
,'A{fx}

I wonder if someone could tell me the right syntax so that these commands does what I expect.

Thanks in advance for your help
Emerson


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)