TAILIEUCHUNG - Windows Admin Scripting Little Black Book- P6

Windows Admin Scripting Little Black Book- P6:This book may not be duplicated in any way without the express written consent of the publisher, except in the form of brief excerpts or quotations for the purposes of review. The information contained herein is for the personal use of the reader and may not be incorporated in any commercial programs, other books, databases, or any kind of software without written consent of the publisher. Making copies of this book or any portion for any purpose other than your own is a violation of United States copyright laws | Although certain file types such as MP3s do not belong in the public share you may want to keep them for your own purposes. To move files with a specific extension to a central directory proceed as follows 1. Create a new directory to store all files included in this example. 2. Download and install the latest version of Windows Script Host from to the new directory. 3. Select Start Run and enter cscript . Here scriptfile is the full path and file name of a script file that contains the following Set FSO CreateObject sEXT extension sDIR startdir sNEW enddir Set objDIR GetFolder sDIR GoSubFolders objDIR Sub MainSub objDIR For Each efile in fNAME efile fEXT If LCase fEXT LCase sEXT Then sEXIST sNEW If sEXIST AND _ efile sEXIST Then DelFile sEXIST End If On Error Resume Next MoveFile efile sNEW End If Next End Sub Here extension is the name of the extension to search for startdir is the name of the directory to start the search and enddir is the directory to store all files. Note You need to append the GoSubFolders DelFile and GetFolder routines listed earlier in this chapter to this script in order for it to run. Moving a Folder To move a folder with WSH you can use the MoveFolder method. Here is a subroutine to move a folder Sub MoveFolder sFOLDER sDIR If Right sFOLDER 1 Then sFOLDER Left sFOLDER Len sFOLDER -1 End If If Right sDIR 1 Then sDIR sDIR On Error Resume Next sFOLDER sDIR If 0 Then Error moving folder sFOLDER End If End Sub Here sFOLDER is the folder to move and sDIR is the location to move the folder to. Renaming a File To rename a file proceed as follows 1. Create a new directory to store all files included in this example. 2. Download and install the latest version of Windows Script Host from to the new directory. 3. Select Start Run and enter cscript .

TAILIEUCHUNG - Chia sẻ tài liệu không giới hạn
Địa chỉ : 444 Hoang Hoa Tham, Hanoi, Viet Nam
Website : tailieuchung.com
Email : tailieuchung20@gmail.com
Tailieuchung.com là thư viện tài liệu trực tuyến, nơi chia sẽ trao đổi hàng triệu tài liệu như luận văn đồ án, sách, giáo trình, đề thi.
Chúng tôi không chịu trách nhiệm liên quan đến các vấn đề bản quyền nội dung tài liệu được thành viên tự nguyện đăng tải lên, nếu phát hiện thấy tài liệu xấu hoặc tài liệu có bản quyền xin hãy email cho chúng tôi.
Đã 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.