建立檔案到期工作Create a File Expiration Task

適用於:Windows Server (半年度管道)、Windows Server 2016、Windows Server 2012 R2、Windows Server 2012、Windows Server 2008 R2Applies to: Windows Server (Semi-Annual Channel), Windows Server 2016, Windows Server 2012 R2, Windows Server 2012, Windows Server 2008 R2

下列程序將引導您針對即將到期的檔案完成建立檔案管理工作的程序。The following procedure guides you through the process of creating a file management task for expiring files. 檔案到期工作用於自動將所有符合特定條件的檔案移到指定的到期目錄,系統管理員可接著在其中備份和刪除這些檔案。File expiration tasks are used to automatically move all files that match certain criteria to a specified expiration directory, where an administrator can then back those files up and delete them.

執行檔案到期工作時,會在到期目錄中建立新目錄,目錄是依執行工作的伺服器名稱分組。When a file expiration task is run, a new directory is created within the expiration directory, grouped by the server name on which the task was run.

新的目錄名稱會依據檔案管理工作名稱和執行時間來命名。The new directory name is based on the name of the file management task and the time it was run. 找到已到期的檔案時,便會將該檔案移到新目錄,同時保留其原始目錄結構。When an expired file is found it is moved into the new directory, while preserving its original directory structure.

若要建立檔案到期工作To create a file expiration task

  1. 按一下 [檔案管理工作] 節點。Click the File Management Tasks node.

  2. [檔案管理工作] 上按滑鼠右鍵,再按一下 [建立檔案管理工作] (或按一下 [動作] 窗格中的 [建立檔案管理工作])。Right-click File Management Tasks, and then click Create File Management Task (or click Create File Management Task in the Actions pane). 如此會開啟 [建立檔案管理工作] 對話方塊。This opens the Create File Management Task dialog box.

  3. [一般] 索引標籤中,輸入下列資訊:On the General tab, enter the following information:

    • [名稱]Name. 輸入新工作的名稱。Enter a name for the new task.

    • [描述]Description. 輸入此工作的選擇性描述標籤。Enter an optional descriptive label for this task.

    • [領域]Scope. 使用 [新增] 按鈕以新增這項工作操作的目錄。Add the directories that this task should operate on by using the Add button. (選用) 您可以使用 [移除] 按鈕從清單中移除目錄。Optionally, directories can be removed from the list using the Remove button. 管理工作檔案將會套用至此清單中的所有資料夾及其子資料夾。The file management task will apply to all folders and their subfolders in this list.

  4. [動作] 索引標籤中,輸入下列資訊:On the Action tab, enter the following information:

    • [類型]Type. 從下拉式清單方塊中選取 [檔案到期]Select File Expiration from the drop-down box.

    • [到期目錄]Expiration Directory. 選取檔案到期後要移到的目錄。Select a directory where files will be expired to.

      警告

      請勿選取工作領域內的目錄,如上一個步驟中所定義。Do not select a directory that is within the scope of the task, as defined in the previous step. 如此會造成導致系統不穩定以及資料遺失的反覆迴圈。Doing so could cause an iterative loop that could lead to system instability and data loss.

  5. 選擇性地在 [通知] 索引標籤上按一下 [新增],在工作對檔案執行動作的指定至少天數前,傳送電子郵件通知、記錄事件,或執行命令或指令碼。Optionally, on the Notification tab, click Add to send e-mail notifications, log an event, or run a command or script a specified minimum number of days before the task performs an action on a file.

    • [執行工作以傳送通知之前的天數] 下拉式方塊中,輸入或選取一個值以指定在對檔案執行傳送通知動作之前的至少天數。In the Number of days before task is executed to send notification combo box, type or select a value to specify the minimum number of days prior to a file being acted on that a notification will be sent.

      注意

      只有在執行工作時才會傳送通知。Notifications are sent only when a task is run. 如果指定要傳送通知的至少天數與排定的工作不一致,將會在上一個已排程工作的那一天傳送通知。If the specified minimum number of days to send a notification does not coincide with a scheduled task, the notification will be sent on the day of the previous scheduled task.

    • 若要設定電子郵件通知,請按一下 [電子郵件訊息] 索引標籤,並輸入下列資訊:To configure e-mail notifications, click the E-mail Message tab and enter the following information:

      • 若要在已達閾值時通知系統管理員,請選取 [將電子郵件傳送給下列系統管理員] 核取方塊,並輸入要接收通知的系統管理帳戶名稱。To notify administrators when a threshold is reached, select the Send e-mail to the following administrators check box, and then enter the names of the administrative accounts that will receive the notifications. 使用 account@domain 格式,並使用分號隔開多個帳戶。Use the format account@domain, and use semicolons to separate multiple accounts.

      • 若要傳送電子郵件給檔案即將到期的使用者,請選取 [傳送電子郵件給檔案即將到期的使用者] 核取方塊。To send e-mail to the person whose files are about to expire, select the Send e-mail to the user whose files are about to expire check box.

      • 若要設定訊息,請編輯提供的預設主旨列和郵件內文。To configure the message, edit the default subject line and message body that are provided. 方括弧中的文字會插入關於引發通知之配額事件的變數資訊。The text that is in brackets inserts variable information about the quota event that caused the notification. 例如,[Source File Owner] 變數會插入檔案即將到期之使用者的名稱。For example, the [Source File Owner] variable inserts the name of the user whose file is about to expire. 若要在文字中插入其他變數,請按一下 [插入變數]To insert additional variables in the text, click Insert Variable.

      • 若要附加即將到期檔案的清單,請按一下 [將要執行動作的檔案清單附加至電子郵件],並輸入或選取 [清單中的檔案數目上限] 的值。To attach a list of the files that are about to expire, click Attach to the e-mail list of files on which action will be performed, and type or select a value for Maximum number of files in the list.

      • 若要設定其他標頭 (包括 [寄件者]、[副本]、[密件副本] 和 [回覆]),請按一下 [其他電子郵件標頭]To configure additional headers (including From, Cc, Bcc, and Reply-to), click Additional E-mail Headers.

    • 若要記錄事件,按一下 [事件記錄檔]索引標籤並選取 [將警告傳送給事件記錄檔] 核取方塊,然後編輯預設記錄項目。To log an event, click the Event Log tab and select the Send warning to event log check box, and then edit the default log entry.

    • 若要執行命令或指令碼,按一下 [命令] 索引標籤,並選取 [執行這個命令或指令碼] 核取方塊。To run a command or script, click the Command tab and select the Run this command or script check box. 然後輸入命令,或按一下 [瀏覽] 以搜尋儲存指令碼所在的位置。Then type the command, or click Browse to search for the location where the script is stored. 您也可以輸入命令引數、選取命令或指令碼的工作目錄,或修改命令安全性設定。You can also enter command arguments, select a working directory for the command or script, or modify the command security setting.

  6. 選擇性地使用 [報告] 索引標籤來產生一或多個記錄檔或存放裝置報告。Optionally, use the Report tab to generate one or more logs or storage reports.

    • 若要產生記錄檔,請選取 [產生記錄] 核取方塊,然後選取一個或多個可用的記錄檔。To generate logs, select the Generate log check box and then select one or more available logs.

    • 若要產生報告,請選取 [產生報告] 核取方塊,然後選取一個或多個可用的報告格式。To generate reports, select the Generate a report check box and then select one or more available report formats.

    • 若要建立電子郵件產生的記錄檔或存放裝置報告,請選取 [將報告傳送給下列系統管理員] 核取方塊,然後使用 account@domain 格式輸入一個或多個系統管理電子郵件收件者。To create e-mail generated logs or storage reports, select the Send reports to the following administrators check box and type one or more administrative e-mail recipients using the format account@domain. 使用分號隔開多個電子郵件地址。Use a semicolon to separate multiple addresses.

      注意

      此報告會儲存在事件報告的預設位置中,您可以在 [檔案伺服器資源管理員選項] 對話方塊中修改預設位置。The report is saved in the default location for incident reports, which you can modify in the File Server Resource Manager Options dialog box.

  7. 選擇性地使用 [條件] 索引標籤,只針對符合一組定義條件的檔案執行此工作。Optionally, use the Condition tab to run this task only on files that match a defined set of conditions. 可用的設定如下:The following settings are available:

    • [屬性條件]Property conditions. 按一下 [新增] 建立以檔案分類為依據的新條件。Click Add to create a new condition based on the file's classification. 這樣會開啟 [屬性條件] 對話方塊,允許您選擇屬性、要對屬性執行的運算子,以及要跟屬性比較的值。This will open the Property Condition dialog box, which allows you to select a property, an operator to perform on the property, and the value to compare the property against. 按一下 [確定] 後,即可接著建立其他條件,或是編輯或移除現有的條件。After clicking OK, you can then create additional conditions, or edit or remove an existing condition.

    • [自上次修改檔案以來的天數]Days since file was last modified. 按一下核取方塊,然後在微調方塊中輸入天數。Click the check box and then enter a number of days into the spin box. 這樣將導致檔案管理工作只會套用至已超過指定天數未經修改的檔案。This will result in the file management task only being applied to files that have not been modified for more than the specified number of days.

    • [自上次存取檔案以來的天數]Days since file was last accessed. 按一下核取方塊,然後在微調方塊中輸入天數。Click the check box and then enter a number of days into the spin box. 如果伺服器已設定為追蹤上次存取檔案之時的時間戳記,這樣將導致檔案管理工作只會套用至已超過指定天數未經存取的檔案。If the server is configured to track timestamps for when files were last accessed, this will result in the file management task only being applied to files that have not been accessed for more than the specified number of days. 如果伺服器未設定為追蹤存取的時間,這個條件就沒有效果。If the server is not configured to track accessed times, this condition will be ineffective.

    • [自檔案建立以來的天數]Days since file was created. 按一下核取方塊,然後在微調方塊中輸入天數。Click the check box and then enter a number of days into the spin box. 這將會導致工作只會套用到至少在指定天數前建立的檔案。This will result in the task only being applied to files that were created at least the specified number of days ago.

    • [生效日期]Effective starting. 設定此檔案管理工作要開始處理檔案的日期。Set a date when this file management task should start processing files. 此選項很有用,可以將工作延遲直到您有機會通知使用者或預先做其他準備時。This option is useful for delaying the task until you have had a chance to notify users or make other preparations in advance.

  8. [排程] 索引標籤上,按一下 [建立排程],然後按一下 [排程] 對話方塊中的 [新增]On the Schedule tab, click Create Schedule, and then in the Schedule dialog box, click New. 如此會顯示每天上午 9:00 設定的預設排程,This displays a default schedule set for 9:00 A.M. 但您還是可以修改預設排程。daily, but you can modify the default schedule. 當您設定排程完畢時,按一下 [確定],然後再按一次 [確定]When you have finished configuring the schedule, click OK and then click OK again.

請參閱See also