[in .vbs] [3in1]创建多个文件夹180 =>在All 180 =>中创建子文件夹在创建的子文件夹中移动文件并重命名文件[3in1]“x,y,z”

时间:2014-04-18 08:15:38

标签: vbscript adsutil.vbs

" x,y,z" (垂直,水平,移动和重命名文件。) 我想结合3in1(x,y,z。)。vbs

in .vbs [summary]

首先在这里阅读

" x" Trying to create multiple folders with VBScript

Option Explicit
Dim objFSO, objFolder, strDirectory, i
strDirectory = "C:\New folder (2)\"

Set objFSO = CreateObject("Scripting.FileSystemObject")
i = 0
While i < 180
Set objFolder = objFSO.CreateFolder(strDirectory & i)
i = i+1
WScript.Quit
Wend

&#34; y&#34; Help To create Folder1/Folder2 in Windows using VBScript ( Both the folders not exists before, i mean to create multilevel folders @ a strech.)

Set objShell = CreateObject("Wscript.Shell")
objShell.Run "cmd /c mkdir C:\folder1\folder2\folder3"

Set fs = CreateObject("Scripting.FileSystemObject")
fs.CreateFolder("C:\New folder\Client")
fs.CreateFolder("C:\New folder\Client\subclient")
fs.CreateFolder("C:\New folder\Client\subclient\subsubclient")

&#34; Z&#34;

Set x = CreateObject("Scripting.FileSystemObject")
x.MoveFile "C:\myfile.txt" , "C:\New folder\myfile222.txt"

我想要制作

我希望你明白我在哪里&#34; x,y,z&#34; (垂直,水平,移动和重命名文件。)

&#34; X&#34;创建多个文件夹(i = 0 | i&lt; 180个文件夹)

&#34; Y&#34;子文件夹(在所有&#34; x&#34; 180个文件夹中)

&#34; Z&#34;并移动文件并在新位置重命名

myFSO.MoveFile&#34; C:\ myfile1.txt&#34; ,&#34; C:\ New folder \ myfile222.txt&#34;

180发送到每个180&#34; x,y&#34; ...子文件夹


1)创建多个文件夹,如脚本0-180文件夹

2)在创建的所有180个文件夹中创建子文件夹。

3)移动文件(C:\ Name.txt)并重命名子文件夹中的文件(C:\ New folder \ FolderB \ Folder1 \ FolderQ \ folder3 \ folderG \ myfile222.txt)

C:\ New folder \ FolderB \ Folder1 \ FolderQ \ folder3 \ folderG

我希望将所有内容合并到一个脚本中。


我需要[创建多个文件夹] [并且每个文件夹创建180] =&gt;&gt; [我想创建子文件夹] [并移动文件(name.txt)并在子文件夹中重命名]

ex:文件夹i&lt; 180,在每个文件夹中创建1-180我要在所有180个文件夹中创建子文件夹

&#34; X&#34;创建多个文件夹,如(i = 0 | i&lt; 180文件夹)

&#34; Y&#34;像

这样的子文件夹

&#34; C:\ New folder \ FolderB \ Folder1 \ FolderQ \ folder3 \ folderG

&#34; Z&#34;在子文件夹中移动文件和重命名文件,如

myFSO.MoveFile&#34; C:\ myfile1.txt&#34; ,&#34; C:\ New folder \ myfile222.txt&#34;

myFSO.MoveFile&#34; C:\ myfile1.txt&#34; ,&#34; C:\新文件夹\ FolderB \ Folder1 \ FolderQ \ folder3 \ folderG \ myfile222.txt&#34;

我想将多个文件夹与每个文件夹中的子文件夹组合180,并移动文件(Name.txt)并重命名子文件夹中的文件(FolderG)

谢谢你的帮助。 请原谅我在英文中翻译的英文翻译 我希望你能理解我和他一起去的地方&#34; x,y,z&#34; (垂直,水平,文件。)

1 个答案:

答案 0 :(得分:1)

Dim i

With CreateObject("Scripting.FileSystemObject")
    For i = 0 to 179
        SmartCreateFolder "C:\Test\MySet\Folder" & i
        .CopyFile "C:\Test\data.txt", "C:\Test\MySet\Folder" & i & "\file_" & Left(CreateObject("Scriptlet.TypeLib").GUID, 38) & ".txt", True
    Next
    .DeleteFile "C:\Test\data.txt", True
End With

Sub SmartCreateFolder(strFolder)
    ' http://www.visualbasicscript.com/tm.aspx?m=29290
    With CreateObject("Scripting.FileSystemObject")
        If Not .FolderExists(strFolder) then
            SmartCreateFolder(.getparentfoldername(strFolder))
            .CreateFolder(strFolder)
        End If
    End With 
End Sub

感谢SmartCreateFolder 2 @EBGreen