Microsoft WSH and VBScript Programming for the Absolute Beginner Part 28

Microsoft WSH and VBScript Programming for the Absolute Beginner by Jerry Lee Ford Part 28. If you are new to programming with Microsoft WSH and VBScript and are looking for a solid introduction, this is the book for you. Developed by computer science professors, books in the for the absolute beginner series teach the principles of programming through simple game creation. You will acquire the skills that you need for more practical WSH and VBScript programming applications and will learn how these skills can be put to use in real-world scenarios. Best of all, by the time you finish this book,. | Microsoft WSH and VBScript Programming for the Absolute Beginner Second Edition Copying One or More Files You can copy one or more files using the CopyFile method. This method also supports an additional parameter that allows you to specify what to do if the script attempts to copy a file to a folder that already contains a file with the same name. You specify a value of either True or False for this parameter. A value of True tells CopyFile to replace or override files with duplicate file names. A value of False tells CopyFile to cancel the copy operation for any files with matching file names. The following example demonstrates how to copy all files with a .txt file extension located in the C Temp folder to a folder called C VBScriptGames without allowing any duplicate files already located in the destination folder to be overridden Dim objFso Set objFso C C VBScriptGames False This next example does the exact same thing as the previous example except that it allows duplicate files to be overridden Dim objFso Set objFso C C VBScriptGames True Remember you can avoid errors by using the FileSystemObject object s FileExists and FolderExists properties to verify whether a file or folder exists before manipulating them. Moving One or More Files The difference between moving and copying files is that after you copy a file you end up with two copies in two places whereas when you move a file only the one file exists in its new location. You can move files from one folder to another using the FileSystemObject object s MoveFile method Dim objFso Set objFso C C VBScriptGames In this example all files with a .txt file extension are moved from the C Temp folder into the C VBScriptGames folder. Chapter 8 Storing and Retrieving Data Deleting One or More Files

Không thể tạo bản xem trước, hãy bấm tải xuống
TÀI LIỆU MỚI ĐĂNG
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.