Home > Software engineering >  Bat Windows batch file processing
Bat Windows batch file processing

Time:11-19

Use the bat batch file program movement quantity specified file to the specified folder, for example, A folder image existing 100 pieces, you need to first 20 pictures folder, move to B asked the great spirit

CodePudding user response:

Bat may be difficult, simple words can use VBS:
 
The set of fso=createobject (" scripting. Filesystemobject ")
Curdir=fso. Getparentfoldername (wscript. Scriptfullname)
DirA=fso. Buildpath (curdir, "A")
DirB=fso. Buildpath (curdir, "B")
For each objfile in fso. Getfolder (dirA.) files
If lcase (fso) getextensionname (objfile. Name))="JPG" then
Objfile. Move fso. Buildpath (dirB, objfile name)
The count=count + 1
If the count & gt; 20 then=
The exit for
End the if
End the if
Next
Msgbox "done!"

Run the example:

Download address:
Link: https://pan.baidu.com/s/1B5hCTrcjer1x4s6lIWUcjQ
The extracted code: jcit

CodePudding user response:

I also feel a bit hard for you, thank you very much

CodePudding user response:

reference 1st floor milaoshu1020 response:
bat may be difficult, and can use simpler words VBS:
 
The set of fso=createobject (" scripting. Filesystemobject ")
Curdir=fso. Getparentfoldername (wscript. Scriptfullname)
DirA=fso. Buildpath (curdir, "A")
DirB=fso. Buildpath (curdir, "B")
For each objfile in fso. Getfolder (dirA.) files
If lcase (fso) getextensionname (objfile. Name))="JPG" then
Objfile. Move fso. Buildpath (dirB, objfile name)
The count=count + 1
If the count & gt; 20 then=
The exit for
End the if
End the if
Next
Msgbox "done!"

Run the example:

Download address:
Link: https://pan.baidu.com/s/1B5hCTrcjer1x4s6lIWUcjQ
Extract the code: jcit

That I want to ask, this is copy, if cut need to change

CodePudding user response:

This is a mobile, not copy;

CodePudding user response:

reference 4 floor milaoshu1020 response:
this is moving, not copy;

Ok, I see the wrong, sorry sorry
  • Related