Ask The Experts
Ask The Experts
Get-ChildItem | Where-Object {$_.LastWriteTime -gt '10/1/18' -and $_.LastWriteTime -lt '11/1/18'} | foreach {Copy-Item -Path $_.filename -Destination .\201810\}
i received this from another source:
Ok, then you should try something like this:
xcp copy -match “created < 1*year” <source> <target>
xcp copy -match “modified < 1*year” <source> <target>
The given examples can be combined to a single command to filter the files created and modified in the same time.
xcp copy -match “created < 1*year and modified < 1*year” <source> <target>
if you want to find more details about how to use the match filter please run “xcp help -match” command.
to all who read this:
yes i ran the xcp help -match command and after reading the help output i'm still didn't gain the knowledge to use what i read.
However the examples provided did give rise to, 2 more questions:
xcp copy –match “created = 2017year and > 2month and < 3month” <source> <target>
looking for files created feb. 2017 and what if i was looking for feb 2015.
while I can get date components to work fine, I can't access any time components for match. I get name 'hour' is not defined etc..., I used modified and mtime... Was trying to setup a precopy of data without running into a file being activiely written to.
xcp copy -match "mtime>1*hour" <source> <destination>
Error: Error evaluating expression "mtime>1*hour": name 'hour' is not defined.
Tried every varation of hour that I could think of as well. Is there some fmt(iso(mtime)) required?