Jump to content

Recommended Posts

Posted

HI

Should I create a list of n subdirectory known and I should run some commands in any other subdirectory of the same branch. How do I write this cmd script so I can write from the command prompt "script-name directory subdirectory1 subdirectory2 subdirectory3 ... subdirectoryn" ?

THANKS

BYE


Posted

Okay, before this topic gets as 'out of control' as your others, referenced above, I'll toss you a life line.

Explain once only, fully and in good English, exactly what it is you want someone to do for you.

In order to do this all pertinent information must be provided. This information will include, but will not be limited to, what you have so far, full file structures with real names as applicable, operating system(s) etc.

If you are capable of doing that then you will be aided in your goal, otherwise I can only see a re-occurring pattern!

Posted

Since I am having troubles understanding what you want to do, it sounds like you want a script to go threw

all the sub folders in the parent folder. Try this VBS script it will list the contents of all the sub folders in the

parent folder. This will saved all the information in a text file in the parent folder.

Save as ListSubFolder.vbs

 Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Dir :Dir = "."
Dim Path, Ts
Path = Fso.GetParentFolderName(WScript.ScriptFullName) & "\DirectoryFolderList.txt"
Set Ts = Fso.CreateTextFile(Path)
Ts.WriteLine "Start Time : " & Now & vbCrLf
Ts.WriteLine "Start Folder : " & Replace(WScript.ScriptFullName,WScript.ScriptName,"")
Recursive Fso.GetFolder(Dir)
Ts.Close
CreateObject("Wscript.Shell").Run("notepad.exe " & Chr(34) & Path & Chr(34)),1,True
'-> Searches Threw The Parent Folder And All Sub Folders
Function Recursive(Folder)
Dim Col
'-> Collect All The Files In Each Folder
For Each Col In Folder.Files
Ts.WriteLine Col.Name
Next
Ts.WriteBlankLines(1)
Dim Obj
For Each Obj In Folder.subFolders
Ts.WriteLine Obj.Path
Recursive Obj
Next
End Function

Posted
Since I am having troubles understanding what you want to do, it sounds like you want a script to go threw

all the sub folders in the parent folder. Try this VBS script it will list the contents of all the sub folders in the

parent folder. This will saved all the information in a text file in the parent folder.

Save as ListSubFolder.vbs

 Dim Fso :Set Fso = CreateObject("Scripting.FileSystemObject")
Dim Dir :Dir = "."
Dim Path, Ts
Path = Fso.GetParentFolderName(WScript.ScriptFullName) & "\DirectoryFolderList.txt"
Set Ts = Fso.CreateTextFile(Path)
Ts.WriteLine "Start Time : " & Now & vbCrLf
Ts.WriteLine "Start Folder : " & Replace(WScript.ScriptFullName,WScript.ScriptName,"")
Recursive Fso.GetFolder(Dir)
Ts.Close
CreateObject("Wscript.Shell").Run("notepad.exe " & Chr(34) & Path & Chr(34)),1,True
'-> Searches Threw The Parent Folder And All Sub Folders
Function Recursive(Folder)
Dim Col
'-> Collect All The Files In Each Folder
For Each Col In Folder.Files
Ts.WriteLine Col.Name
Next
Ts.WriteBlankLines(1)
Dim Obj
For Each Obj In Folder.subFolders
Ts.WriteLine Obj.Path
Recursive Obj
Next
End Function

In other words, if I have the structure:

Folder1

--- SubFolder1

--- SubFolder2

--- SubFolder3

--- SubFolder4

I would need to write, from the command line:

"delete-script / Folder1 / SubFolder1 / SubFolder2" and, therefore, the resulting structure should be:

Folder1 -

--- SubFolder1

--- SubFolder2

Then, your script does this? If no, please, you can modify this script?

THANKS

BYE

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...