Hello. It is necessary to send a whole folder or files of a certain type, from a certain folder with subfolders, by e-mail or FTP from a VBS file. I rummaged through the entire Internet, but did not find it, except for those scripts that actually work, but alas, with a specific file. Also, the name of the file sent by e-mail or FTP cannot be known to me, therefore I am looking for a script that can send files from a folder with subfolders by e-mail or FTP without parsing.

Help me please! Thank you in advance!

  • скриптов, которые действительно работают, но увы, с конкретным файлом. Now find the code for searching the directory files (not including or including subdirectories) and merge. - Akina
  • I see. Of course, the idea of ​​archiving a folder arose, but you need to ensure that the archiving process itself is not noticed. There is a -ibck WInRAR key, but it highlights the taskbar icon. Is there a solution? - user237972

1 answer 1

I see. Of course, the idea of ​​archiving a folder arose, but you need to ensure that the archiving process itself is not noticed. There is a -ibck WInRAR key, but it highlights the taskbar icon. Is there a solution?

You can use Windows tools, even Windows XP had built-in support for ZIP archives. The code below will add files to the folder programmatically, without any information from the user.

  Dim fs, wsh, sh, file_to_zip Set fs = CreateObject("Scripting.FileSystemObject") Set wsh = CreateObject("WScript.Shell") Set sh = CreateObject("Shell.Application") Set file_to_zip = fs.CreateTextFile("C:\Users\User\Desktop\for_testing.zip") ' This line writes a zip file header to the TextStream object: file_to_zip.Write "PK" & Chr(5) & Chr(6) & String(18, Chr(0)) file_to_zip.Close ' This line creates the zip archive: sh.NameSpace("C:\Users\User\Desktop\for_testing.zip").CopyHere "C:\Users\User\Desktop\for_testing"