Module 3: Power Automate for Desktop – Find and Delete Empty Files

  1. Home
  2. »
  3. Business Applications
  4. »
  5. Power Automate
  6. »
  7. Module 3: Power Automate for Desktop – Find and Delete Empty Files
Power Automate for Desktop

Danh mục bài viết:

1. Giới Thiệu

Tiếp tục làm quen với Example Desktop Flow. Trong Module 3 bạn sẽ sử dụng Example Find and Delete Empty Files để xóa tất cả các file có file size bằng 0 bytes.
Sau một thời gian làm việc (chỉnh sửa, xóa nội dung file) chắc chắn sẽ có một số file có kích thước bằng 0 (file size = 0). Bạn cần tìm và xóa tất cả các file này. Công việc này nếu làm cách thủ công cũng sẽ mất nhiều thời gian. Power Automate for Desktop sẽ giúp bạn thực công việc này nhanh hơn, ít tốn thời gian hơn.

2. Chuẩn bị

Để thực hiện bài lab này bạn phải thực hiện xong Module 1: download và install Power Automate for desktop.
Trên đĩa C:\ bạn tạo folder Test, và trong folder này bạn tạo vài file có nội dung và một số file không có nội dung để làm file thử nghiệm.

Find and Delete Empty Files

3. Find and Delete Empty Files Flow

3.1 Tìm hiểu Find and Delete Empty Files Example

1. Double click vào icon Power Automate trên desktop khởi chạy Power Automate for Desktop.
2. Tại cửa sổ Power Automate chọn Examples trên thanh công cụ và chọn Desktop Automation

Find and Delete Empty Files

3. Trong Desktop Automation chọn Find and Delete Empty Files, và chọn icon cây viết để xem và chỉnh sửa flow example.

Find and Delete Empty Files

4. Tại của sổ Main của flow Find and Delete Empty Files, double click vào Display select folder dialog (Khi thực thi Action này yêu cầu bạn chọn Folder chứa các file cần tìm file có kích thước bằng 0 (file size =0), tên folder mà bạn chọn sẽ gán giá trị cho biến SelectedFolder) ấn Save.

Find and Delete Empty Files

5. Tại của sổ Main của flow Find and Delete Empty Files, double click vào Get files in folder (Action này sẽ get tất cả file name có trong folder đã chọn lưu vào biến AllFilesInFolder) ấn Save.

Find and Delete Empty Files

6. Tại của sổ Main của flow Find and Delete Empty Files, Action For each sẽ chạy từ CurrentFile cho đến hết các file trong AllFilesInFolder
7. Nếu CurrentFile.Size = 0 sẽ thực hiện xóa CurrentFile

Find and Delete Empty Files

8. Trên thanh công cụ chọn Save As, cửa sổ Save As nhập vào Find and Delete Empty Files ấn Save, chờ Save xong ấn Close

3.2 Thực Thi Flow và Kiểm Tra Kết Quả

1. Tại màn hình Find and Delete Empty Files trên thanh công cụ chọn Run, sẽ xuất hiện cửa sổ cho bạn chọn folder C:\Test, ấn Ok, chờ Flow thực hiện xong. (Chú ý quan sát flow thực thi)

Find and Delete Empty Files

2. Bạn vào C:\Test để kiểm tra kết quả, các file có file size = 0 đã bị xóa

Find and Delete Empty Files

Bạn đã hoàn tất module 3 tìm hiểu và triển khai desktop flow Example. Qua bài lab này bạn thấy Desktop flow giúp bạn tìm và xóa file có file size =0 tự động.

Bài viết công nghệ: