Windows 7 Forums

Welcome to Windows 7 Forums. Our forum is dedicated to helping you find support and solutions for any problems regarding your Windows 7 PC be it Dell, HP, Acer, Asus or a custom build. We also provide an extensive Windows 7 tutorial section that covers a wide range of tips and tricks.

Windows 7: Possible to create "file rules" similar to email rules

08 Jun 2012   #1

Windows 7 Professional 32-bit, Windows 8 Pro (sometimes)
Possible to create "file rules" similar to email rules

Hi guys,

Ive been searching around for a way to get files to copy themselves from a certain folder into another one IF they're below a certain size. I was wondering if anyone knows of a program or script that I can schedule to do this for me.

Basically heres the problem: When I download work it goes to the downloads folder where I want it. I use dropbox and sometime I save work into the downloads folder assuming its in the dropbox folder and will sync to the cloud, only when I open my work computer I realise that the file is not present. I want to know if i can set files below a certain size (say 50MB, so I dont get huge downloaded videos and apps syncing) to copy into a temporary location in my dropbox folder as soon as they are saved or changed.


My System SpecsSystem Spec

08 Jun 2012   #2

XP / Win7 x64 Pro

Moving files based on size and moving files based on changes to them are very different problems, the former being the easiest to solve. You can write a batch file to run every x amount of time (via task scheduler) that will scan the directory and copy files if they are smaller than a certain size. You might create a file called "size.bat" within the same directory

@echo off

set maxsize=52428800 

FOR /F "usebackq delims=" %%A in (`dir /a-d-h /b`) do (

set size=%%~zA

if %size% LSS %maxsize% (
copy "%%A" "C:\Dropbox"

The above file will scan the current directory (for only files, omitting the scanning of any subfolders) and will copy any files it finds to be less than 50MB (which equals 52428800 bytes) to the C:\Dropbox directory. Obviously, you will have to change that directory to wherever your Dropbox directory currently resides. And, you can change the maxsize as well. Just make sure you translate the size into bytes as that's how the "dir" command natively reports back file sizes.

You can then use Task Scheduler to set up this batch file to run at whatever interval you'd like to transfer the files.

The latter issue of copying files based on changes is a much more involved issue that I don't currently have the time to address, but it's doable with the same concepts and coding I've shown you here.
My System SpecsSystem Spec

 Possible to create "file rules" similar to email rules

Thread Tools

Similar help and support threads
Thread Forum
Outlook 2010 - Rules disappeard when I set up Exchange email account
I am using Outlook 2010 on W7 64 in my home office. All my email accounts are POP3. My part-time work wanted me to use an email account on their Exchange server (2003). I used the email account setup in my Outlook to set it up successfully. Outlook searched out the Exchange server and set up...
Microsoft Office
Home Computer System Imaging for Newbies - My "Rules"
This is a quick post, and far from comprehensive. Just have the "urge" to write it down. I've been making and restoring images on my home computers for many years. My success rate is 100%. I'll just state what has worked for me. The important parts. Some may disagree with how I do it, and that's...
Backup and Restore
Cannot create rules in Hotmail
Hi I have Win7 x64 Pro and a Hotmail account that I access in IE9. I am trying to set up rules but when I go to the section "Rules for sorting new messages" and click on the "New" button, nothing happens. Is there something I am missing here?
Browsers & Mail
Outlook Rules and new Email address
I am changing my Internet company next week and this will mean I get a new set of email addresses that I can set up to my hearts desire in my new domain. Question is: Will all my current rules apply to the mail I receive at present from different people after they have updated there info with...
Microsoft Office
AppLocker - Create New Rules
How to Create New Rules in AppLocker in Windows 7 and Windows 8 AppLocker is a feature that replaces the Software Restriction Policies feature. AppLocker helps administrators control which applications and files users can run. These include executable files, scripts, Windows Installer files,...

Our Sites

Site Links

About Us

Find Us

Windows 7 Forums is an independent web site and has not been authorized, sponsored, or otherwise approved by Microsoft Corporation. "Windows 7" and related materials are trademarks of Microsoft Corp.

Designer Media Ltd

All times are GMT -5. The time now is 21:09.

Twitter Facebook Google+

Windows 7 Forums

Seven Forums Android App Seven Forums IOS App