Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Date Modified with increment of 1 for a hole year of files

$
0
0

Hi,

I have a folder called 2013 that contains about 20 folders, each containing rar files for each day of the year so far.  They are backups but I've discovered that some days the backups didn't complete so he file isn't there and I'd like a script to find the missing files

The way I see it I have 2 choices, first as the file names are in this format 130528.rar (YYMMDD) with some logic I could find any missing.  Secondly the date modified, so if I check the first file and it's date modified is 28/05/2013 I could compare this to the next date which is incemented by 1 to 29/05/2013

Something like this

$files = get-childitem -recurse c:\files

foreach ($Folder in $files) {

$latest = get-childitem $folder | Where {!$_.PsIsContainer}|select Name,DirctoryName, LastWriteTime |Sort LastWriteTime -descending | select -first 1}

Now I have the last modified file in a folder I need to see if the next olders file modified date exists and if not then write the offending file to a file

Anyone got any ideas?


Alter De Ruine



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>