Skip to main content
  1. Posts/

Forfiles Command Windows

1 min
windows windows
Table of Contents

Forfiles digunakan untuk memilih satu atau lebih file lalu mengeksekusi perintah pada file tersebut. Perintah ini sangat berguna untuk batch job atau menjalankan perintah pada banyak file tanpa mengesekusi satu per satu.

Syntax
#

FORFILES [/P pathname] [/M searchmask] [/S]
         [/C command] [/D [+ | -] {MM/dd/yyyy | dd}]

Examples
#

List nama file pada direktori saat ini yang tidak diubah (last modified) selama 30 hari terakhir.

forfiles /d -30

Hapus file yang tidak diubah selama 30 hari terakhir

forfiles /d -30 /c "cmd /c del @file"

Cari setiap file dengan ekstensi .txt lalu buka dengan notepad

forfiles /m "*.txt" /c "cmd /c notepad @file"

Pindahkan semua file yang terakhir ubah sebelum 15 Maret 2018 dengan ekstensi .zip pada dir C:\Users\myuser\Downloads ke tujuan C:\Users\myuser\backups

forfiles /s /p "C:\Users\myuser\Downloads" /m "*.zip" /d -"03/15/2018" /c "cmd /c move @path C:\Users\myuser\backups"

Related

Fix Issues in Windows Search
1 min
windows windows
Quick Fix for Truncated PowerShell Output
1 min
windows windows
Mengatasi Error Credssp Pada Remote Desktop
1 min
windows windows
Instalasi Ventoy Menggunakan LiveCD
1 min
windows windows vmware
Update Windows Defender Secara Manual
1 min
windows windows
Improving PC Performance in Windows
1 min
windows windows