I'm looking for some windows command line to scan through a directory which contains sub directories and moves files over a certain size to a new directory. I haven't been able to come up with a solution yet.

  • You can check for graphic tool (file manager) like total commander, which can be used to search in directory tree for files by your criteria, make list of them and you can do them what you want (copy, move, etc) – Romeo Ninov Feb 14 '15 at 17:38

Say you want to move files that are at least 1000 bytes long to a new location that mimics the source folder hierarchy:

robocopy "sourcePath" "destinationPath" /s /min:1000 /mov

If you want to move the files to a single directory (no hierarchy), then you could use the following. But bear in mind that name collisions can result in one file overwriting another in the destination.

for /r "sourcePath" %F in (*) do @if %~zF geq 1000 move "%F" "destinationPath"

Double the percents if you use the command within a batch script.

  • I used the second method. Worked great. – Jared Feb 14 '15 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.