Search Results

Search found 1 results on 1 pages for 'brushwood'.

Page 1/1 | 1 

  • How can I copy files with timestamps between 2 times and preserve the directory structure

    - by brushwood
    I want to copy files that have timestamps from the time the script begins to run and a hour previous. So I am basically trying to emulate robocopy but with minage and maxage going down to the exact time rather than days. So far I have this in powershell: $now = Get-Date $previousHour = $now.AddHours(-1) "Copying files from $previousHour to $now" function DoCopy ($source, $destination) { $fileList = gci $source -Recurse foreach ($file in $fileList) { if($file.LastWriteTime -lt $now -and $file.LastWriteTime -gt $previousHour) { #Do the copy } } } DoCopy "C:\test" "C:\test2" but if I try to do the copy like that, it copies all the files directly into the destination folder rather than the subfolders.enter code here

    Read the article

1