I found the unixutils for Windows and am trying to use the find command to move files older than 30 minutes to a different directory.
I have tried all of the following (also with \\ at the end of SourceDir and/or TargetDir) but get various errors that I'm pretty sure are due to unix using / to delimit directories and Windows using \\ to delimit directories:
find C:\SourceDir -name * -mmin +30 -type f -exec "move {} C:\TargetDir" ;
find C:\SourceDir -name * -mmin +30 -type f -exec "move {} C:\TargetDir" +
find C:\SourceDir -name * -mmin +30 -type f -execdir "move {} C:\TargetDir" ;
find C:\SourceDir -name * -mmin +30 -type f -execdir "move {} C:\TargetDir" +
Has anybody got this to work?
I'm also not tied to using this utility - it just seemed like it would be easy to do. I do have to do it via command line, though, as part of a scheduled job, and would very much prefer not to have to install any software. Copying standalone single file utilities is acceptable, though.
I believe Windows Powershell is available to me, as well.
Thanks!
I found somebody who helped me with Windows Powershell. I thought I'd provide an update here in case it helps somebody else later.
The following Powershell command does the same thing:
get-childitem -Path "C:\SourceDir" -recurse | where-object {$_.LastWriteTime -le (get-date).AddMinutes(-30)} | move-item -destination "C:\TargetDir" -force
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.