Цитата:
bomzzz
-нужно скопировать папку если она есть
-если ее нет - значит ее не нужно копировать...зачем ее создавать? )))
Цитата:
kazavo4ka
...путь не найден... (это если в конце дописывать-а куда нужно то?)
bomzzz
kazavo4ka
Const FolderPath = "C:\" 'Путь к директории
Dim MyPath
Set FSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = WScript.CreateObject("WScript.Shell")
MyPath = left (WScript.ScriptFullName, (Len(WScript.ScriptFullName))-(Len(WScript.ScriptName)))
FSO.CopyFolder FolderPath, MyPath
FolderPath = "C:\"
Set fso = WScript.CreateObject("Scripting.FileSystemObject")
MyPath = WScript.Path
If fso.FolderExists(FolderPath) then FSO.CopyFolder FolderPath, MyPath
...путь не найден... (это если в конце дописывать-а куда нужно то?)
kazavo4ka)
Const FolderPath = "C:\"
Set fso = CreateObject("Scripting.FileSystemObject")
if fso.FileExists(FolderPath & "MyFile") Then
Set mFile = fso.GetFile(FolderPath & "MyFile")
mFile.Copy WScript.Path & "MyFile", True
Else
MsgBox "Бяда! нету файлы, всё пропало"
End If
bomzzz
но вроде не умеет в подпапках искать
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Folder = FSO.GetFolder("C:\Program Files")
For Each SubFolder In Folder.SubFolders
WScript.Echo SubFolder.Name
Next
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Folder = FSO.GetFolder("C:\Program Files")
For Each SubFolder In Folder.SubFolders
Text = Text & SubFolder.Name & vbLf
Next
MsgBox Text
Set FSO = CreateObject("Scripting.FileSystemObject")
Set Folder = FSO.GetFolder("C:\Program Files")
For Each SubFolder In Folder.SubFolders
next
Set FSO = CreateObject("Scripting.FileSystemObject")
MyFolderPath = "C:\Temp"
Call MyProcedure(MyFolderPath)
MsgBox "Фуххх!!!!"
Sub MyProcedure(FolderPath)
If fso.FileExists(FolderPath& "\" & "MyFile") Then
Set myFile = fso.GetFile(FolderPath & "\" & "MyFile")
myFile.Copy WScript.Path & "MyFile", True
MsgBox "Ура нашелся"
End If
Set MyFolder = FSO.GetFolder(FolderPath)
For Each SubFolder In MyFolder.SubFolders
MsgBox FolderPath & "\" & SubFolder.Name
Call MyProcedure(FolderPath & "\" & SubFolder.Name)
Next
End Sub
Set FSO = CreateObject("Scripting.FileSystemObject")
MyFolderPath = "C:\Program Files"
Call MyProcedure(MyFolderPath)
MsgBox "Фуххх!!!!"
Sub MyProcedure(FolderPath)
If fso.FileExists(FolderPath& "\" & "MyFile") Then
Set myFile = fso.GetFile(FolderPath & "\" & "MyFile")
myFile.Copy WScript.Path & "MyFile", True
MsgBox "Ура нашелся"
End If
Set MyFolder = FSO.GetFolder(FolderPath)
For Each SubFolder In MyFolder.SubFolders
Call MyProcedure(FolderPath & "\" & SubFolder.Name)
Next
End Sub
я ж не знаю какая у тебя задача
Set FSO = CreateObject("Scripting.FileSystemObject")
MyFolderPath = "C:\Program Files"
Call MyProcedure(MyFolderPath)
MsgBox "Фуххх!!!!"
Sub MyProcedure(FolderPath)
If fso.FileExists(FolderPath& "\" & "MyFile") Then
Set myFile = fso.GetFile(FolderPath & "\" & "MyFile")
myFile.Copy WScript.Path & "MyFile", True
MsgBox "Ура нашелся"
End If
Set MyFolder = FSO.GetFolder(FolderPath)
For Each SubFolder In MyFolder.SubFolders
Call MyProcedure(FolderPath & "\" & SubFolder.Name)
Next
End Sub
а как ты папку определил?
копирование вот эти строчки дают.
Страницы: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
Предыдущая тема: Работа в Delphi c CryptoApi