Home > Software engineering >  How to batch remove the folder with the number in the TXT file name
How to batch remove the folder with the number in the TXT file name

Time:09-26

How to batch remove folder with the number of the TXT file name
Such as d: \ wj \ abb123 TXT abc124. TXT batch to abb. TXT ABC. TXT

CodePudding user response:

How to obtain various subdirectories under the file name (including the full path)
A post on the VB how to remove the number in the text file name, assume that you have as a function of encapsulation RemoveNumber ()
 Dim colFiles As Collection 
Dim As Long I
Dim s1 As String
Dim s2 As String
The Set colFiles=SearchFiles (" D: \ wj \ ", "*.txt)
For I=1 To colFiles. Count
S1=colFiles (I)
S2=RemoveNumber (s1)
If s1 & lt;> S2 Then
The Name As s1 s2
End the If
Next

CodePudding user response:

Dizzy, the last time you ask a, now ask again "batch", he would not "turn a curved"!


 Private Sub Command1_Click () 
Dim strPath As String
Dim strName As String
Dim strTemp As String
Dim As Long I

StrPath="D: \ wj " 'path finally be \
StrTemp=Dir $(strPath & amp; "*.txt)
Do
If (strTemp="") Then Exit the Do
StrName=strTemp
For I=0 To 9
StrName=Replace (strName, I, "")
Next
If (strName & lt;> StrTemp) Then
The Name strPath & amp; StrTemp As strPath & amp; StrName
End the If
StrTemp=Dir $()
Loop
End Sub

CodePudding user response:

If you only care about I can recommend the building function realizes XRename a tool, a command to the problem is solved, concise and efficient and easy to understand,
 XRename. Exe delete - dir d: \ wj \ string/\ d +/g 



XRename introduced: http://blog.csdn.net/sysdzw/article/details/6198257

The problem solving process completely: http://blog.csdn.net/sysdzw/article/details/50499279

XRename related command:


CodePudding user response:

reference sysdzw reply: 3/f
if you only care about functions XRename I can recommend the building a tool, a command to the problem is solved, concise and efficient and easy to understand,
 XRename. Exe delete - dir d: \ wj \ string/\ d +/g 



XRename introduced: http://blog.csdn.net/sysdzw/article/details/6198257

The problem solving process completely: http://blog.csdn.net/sysdzw/article/details/50499279

XRename related command:


A cow of a command line, just too replication parameters, for no foundation is a sealed book,

CodePudding user response:

Actually slowly reading it's easy,
The console commands not is also one by one to learn,
If the above command in the current directory to be processed is shorter, looks like a natural English,,
 XRename. Exe delete - dir d: \ wj \ string/\ d +/g 'equivalent to the 
Xrename delete - string/\ d +/g

CodePudding user response:

Vb to complete with vb is well
Do not just use the command line
  • Related