ForFiles is a command that you can run via Command Prompt to mainly delete files that go through some custom filters as per your requirements. For example, if you want to make some free space by removing all the files older than one year or six months or so, you can use the ForFiles command to get it done. The only problem is that you can run it on a local computer only. If you want to run the ForFiles command on a shared network drive or folder, you have to map it first.

How to use ForFiles command on Shared Network folder

The ForFiles command to delete, rename, move filer or folders on a Shared Network folder or Mapped network drive in Windows 10. To use ForFiles command on the Shared Network folder, follow these steps- At first, you have to open Command Prompt with administrator privilege. For that, search for cmd in the Taskbar search box. When the search result appears, make sure the Command Prompt is selected. If so, click on the respective Run as administrator option. Next, select the Yes option to open Command Prompt as administrator. Now, you have to map a network drive to run the ForFiles command. For that, type the following command and press the Enter button: Don’t forget to replace the F with the original drive that you want to map, yourusername and password with your username and password. To find a list, enter the following command-

It shows all commands with examples so that you can use them on a mapped network folder on Windows 10. The full syntax you can use is: You can use the ForFiles command like this: You need to replace the F:\folder-path with the actual folder path that you want to delete. The above command lets you delete all files that are folder than 180 days or six months and available in the mentioned folder. There are other commands you can use alongside ForFiles. To list all of the files in the current directory that are at least one year old, type: This post will show you in detail how to schedule ForFiles command on Shared Network drive. Read next: How to remove Map Network Drive and Disconnect Network Drive options from This PC.