Home > Software engineering >  Using vbScript write scripts for help
Using vbScript write scripts for help

Time:09-26

Want to write a vbScript script but do not understand vbScript beg god help

Now have a bunch of photo files a12345.. JPG a12546. JPG a1368. JPG a1389. JPG...

Write a vbScript script can automatically create folders a1 in a1 folder to create the a12 folder a12345. JPG and a12546. JPG etc.
A12 beginning JPG files are moved into the a12 folder

Also in a1 folder automatically create the a12546 a13 folder. JPG a1368. JPG a1389. JPG... Move in so on

CodePudding user response:

Image file where you don't say
I am inside you is a directory by default
Will write to you

CodePudding user response:

 

On the error resume next
Set the ws=WScript. CreateObject (" WScript. Shell ")
W=ws. CurrentDirectory

The Set of fso=WScript. CreateObject (" scripting. Filesystemobject ")
The set oFolder=fso. GetFolder (w)
The set oFiles=oFolder. Files
Fso. CreateFolder w & amp;" "
\ a1For Each uu In oFiles
If instr (uu, "a12) & gt; 0 then
Fso. CreateFolder w & amp;"/a1/a12
"Fso. Used by CopyFile uu, w & amp;" \ \ a12 \ "a1 & amp; Uu. Name
Elseif instr (uu, "a13") & gt; 0 then
Fso. CreateFolder w & amp;" , a1, a13
"Fso. Used by CopyFile uu, w & amp;" \ \ a13 \ "a1 & amp; Uu. Name
End the if
Next


This only wrote a12 a13
Behind you to add a14 such as
Before the end if
Elseif instr (uu, "a14) & gt; 0 then
Fso. CreateFolder w & amp;" , a1, a14
"Fso. Used by CopyFile uu, w & amp;" \ \ a14 \ "a1 & amp; Uu. Name
It is ok
  • Related