Move old files batch script




















Script Center. Sign in. United States English. Ask a question. Quick access. Search related threads. Remove From My Forums. Answered by:. Archived Forums. The Official Scripting Guys Forum! If your answer is "yes," you know what to do.

I think I'd just learned about Split-Path! But it's not a bad script, really, actually quite good. But it does no more than John Grenfell's Robocopy answer, which is probably a better bet for large numbers of files. What's new in Powershell 3. Office Office Exchange Server. Not an IT pro? Windows Server TechCenter. Sign in. United States English. Ask a question. Quick access. Search related threads. Remove From My Forums. For example, this one command can get all the files modified over three months ago.

I do love Powershell methods, and would also suggest using PowerShell, and upgrading any scripts you have to PowerShell. This is actually untested, but the logic should work, let me know if you get any errors.

And always test on a non-production environment, or a test folder. To continue this discussion, please ask a new question. Add a comment. Active Oldest Votes. Matthew Steeples Matthew Steeples 7, 4 4 gold badges 34 34 silver badges 47 47 bronze badges. JPBlanc: Thanks very much, yes I do mean get-childitem.

I'm used to writing gci. Have updated my post — Matthew Steeples. Maurizio Schmidt: If you have files in subfolders this won't do it. You'll have to use the -Recurse flag on get-childitem, and additionally you'll have to work out how to move to the right folder on the destinations — Matthew Steeples.

Matthew: Now it works perfectly, thx. Show 1 more comment. Also be aware of hidden files, try adding -Force to Get-ChildItem.



0コメント

  • 1000 / 1000