Results 1 to 13 of 13
  1. #1
    New Lounger
    Join Date
    Jan 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Subsetting (thinning) Files

    I use the free version of TimeSnapper to help with reporting hours worked on various projects. The program saves a screen capture (png) at a user specified capture rate. To keep the logs manageable I have set the capture rate at one capture every 5 minutes.

    Recently the program reset itself to its default of one capture every 5. I now have several days of log files that I would like to thin down to one capture every 5 minutes, because the capture files are taking up too much space and I have to browse through too many files to find what I want.

    Does anyone know of a way to thin these files down, leaving me with only one capture every 5 minutes. To complicate issues, TimeSnapper stops capturing when the computer is not in use (as when I'm in a meeting or at lunch), so it's not quite as simple as keeping every 60th file and deleting the rest.

    Thanks.

  2. #2
    WS Lounge VIP Coochin's Avatar
    Join Date
    Jun 2014
    Location
    Queensland, Australia
    Posts
    2,154
    Thanks
    31
    Thanked 307 Times in 267 Posts
    Not familiar with that "TimeSnapper" program but you could simply delete any unwanted pngs by using the Ctrl key and looking at the timestamp for each png.
    Computer Consultant/Technician since 1998 (first PC was Atari 1040STE in 1988).
    Most common computing error is EBKAC: Error Between Keyboard And Chairback
    AMD FX8120 (8-core @ 3.1GHz) CPU, Gigabyte GA-990FXA-D3 motherboard, 8GB (2x4GB) DDR3 1866MHz RAM, ATI-AMD Radeon HD6770 PCI-E VGA, 480GB Kingston SSD, 2TB Seagate SATA3.0 HDD, ASUS DVD/RW.

  3. #3
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,191
    Thanks
    48
    Thanked 985 Times in 915 Posts
    You could import them into Excel and run a macro that deleted rows that were less than 5 minutes apart.

    cheers, Paul

  4. #4
    New Lounger
    Join Date
    Jan 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    At one capture every 5 seconds I get over 4000 PNGs every day. I want to thin these down to a about 100. Doing it manually will take a huge amount of time.

    I'm look for a program or a batch script that will do it automatically.


    Quote Originally Posted by Coochin View Post
    Not familiar with that "TimeSnapper" program but you could simply delete any unwanted pngs by using the Ctrl key and looking at the timestamp for each png.

  5. #5
    New Lounger
    Join Date
    Jan 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I don't quite follow you here. How do I import 4000 image files into an Excel sheet? I can see importing the image filenames, but not the files themselves. Can you explain?

    Quote Originally Posted by Paul T View Post
    You could import them into Excel and run a macro that deleted rows that were less than 5 minutes apart.

    cheers, Paul

  6. #6
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,191
    Thanks
    48
    Thanked 985 Times in 915 Posts
    Sorry, I didn't realise they were image files, I thought it was a log.
    If you have a list of the files and times, you can import the list and have excel create the commands to delete the unwanted files based on the time stamp. Can you post a sample of the file list and we can suggest a formula / code?

    cheers, Paul

  7. #7
    New Lounger
    Join Date
    Jan 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Missed your reply back when, and only just noticed it now as I never found a solution and am looking again.

    TimeSnapper creates a new folder each day. I am attaching a partial listing of a typical folder as a sample.

    As you can see, there are many snapshot files. The program default is to save a snapshot every 5 seconds, which results in up to 720 captures per hour for a total of thousands over a typical work day (4000+ is not unusual). Since I like to keep these logs for future reference (they often come in quite handy) I set the capture rate to 5 minutes, which results in a much more manageable number of files (~110/day) and doesn't overload my disk. The problem (as mentioned in my original posting) is that the program sometimes resets itself to 5 second sampling (I suspect it's a Windows issue) so I have a few folders with thousands of captures, and I'd like to thin them down.

    As I also mentioned before, the sampling task is complicated by a TimeSnapper feature whereby it skips making captures when the computer is inactive, such as when I'm at lunch, getting coffee, or at a meeting. In the attached sample you can see examples of this at 08:09 - 08:16 and 08:16 - 08:25, and a bigger gap (lunch) at 12:10 - 13:01. In these cases, fixed sampling of each 60th file (difference between 5 sec and 5 min sampling), would skip too many files.

    Here's the algorithm as I envision it.
    1. Copy the first file in the source folder to a new folder.
    2. Skip to the file with a timestamp 5 minutes (+/- some seconds) later, and copy it to the new folder.
    3. If there is no file with a timestamp within the specified range, that means there's a gap due to inactivity. In that case, copy the last file before the gap and the first file after the gap to the new folder.
    4. Repeat steps 2 & 3 till the end of the folder.

    Would that be difficult to implement?

    Thanks.
    Attached Files Attached Files

  8. #8
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,191
    Thanks
    48
    Thanked 985 Times in 915 Posts
    I reckon a PowerShell script would work nicely here. I'll have a think about it later, unless RG gets in first.

    cheers, Paul

  9. #9
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Paul,

    Clairvoyant once again...

    Yossi,

    Here's some powershell that should solve your problem.

    Code:
    $FldDate = Read-Host "Enter Folder Date in YYYY-MM-DD format"
    
    If ($FldDate -eq "") {
      Write-Host "No Folder Name/Date provides...Exiting!"
      Exit
    }
    
    $x = Get-ChildItem -Path "G:\Test\Snapshots\$($FldDate)\*.*" |
         Sort-Object CreationTime
         
    $Cnt = $x.Count
    
    $BaseTime = $x[0].CreationTime.TimeOfDay.TotalMinutes + 5  # <-Intervalin Minutes
    
    Write-Host "Base Time in Minutes: $BaseTime"
    
    For ( $i = 1 ; $i -lt $cnt; $i++) {
    
       if ($x[$i].CreationTime.TimeOfDay.TotalMinutes -lt $BaseTime) {
    
         Write-Host `
           "$($X[$i].CreationTime.TimeOfDay.TotalMinutes) Delete File: $($X[$i].name)"
    
    #     Remove-Item -Path $x[$i].FullName
       }
       Else {
         $BaseTime = $x[$i].CreationTime.TimeOfDay.TotalMinutes + 5   #Increment Timer
         Write-Host "New Base Time in Minutes: $BaseTime"
    
       }
    }
    If you've never run PowerShell before see this post.

    As the code stands it will NOT delete any files so you can test it to see if it meets your needs. Once you are sure it works for you just remove the # in front of the Remove-Item line. The # is the comment operator in PS so if you want to get rid of some of the verboseness in the code you can place a # in front of the Write-Host items.

    Here's my Testing Info:
    Code:
    Test Files:
    
    754	    Test-IsAdmin.ps1
    811   	Elevator.zip
    816  	PS-Functions-Wired-Wireless.ps1   ** Should be deleted **
    817 	QueryLocalAdmin.ps1
    826 	elevation_header.zip
    1007	PSRemoteSwitch.ps1
    1045	DiskSpaceGUI.ps1
    
    Test Run:
    
    Base Time in Minutes: 698.676622053333
    New Base Time in Minutes: 759.159754561667
    New Base Time in Minutes: 816.367108975
    816.19518234 Delete File: PS-Functions-Wired-Wireless.ps1
    New Base Time in Minutes: 822.346577851667
    New Base Time in Minutes: 831.463886478333
    New Base Time in Minutes: 1011.51354087833
    New Base Time in Minutes: 1049.70384666167
    The code can be changed to allow you to pick the directory from a browse list. I'll be glad to do this for you if the base code meets your needs.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  10. #10
    New Lounger
    Join Date
    Jan 2015
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    RG,

    Thanks for your efforts.

    This is also an opportunity for me to learn about PowerShell, which seems be a really cool and powerful tool.

    Unfortunately, your script deletes all but the first file in the folder. I suppose it has to do with the time calculations.

    I'm attaching a zipped file of a sample folder so you can see what happens (images way downsampled to keep file size reasonable).

    Thanks again,

    Yossi



    Quote Originally Posted by RetiredGeek View Post
    Paul,

    Clairvoyant once again...

    Yossi,

    Here's some powershell that should solve your problem.

    Code:
    $FldDate = Read-Host "Enter Folder Date in YYYY-MM-DD format"
    
    If ($FldDate -eq "") {
      Write-Host "No Folder Name/Date provides...Exiting!"
      Exit
    }
    
    $x = Get-ChildItem -Path "G:\Test\Snapshots\$($FldDate)\*.*" |
         Sort-Object CreationTime
         
    $Cnt = $x.Count
    
    $BaseTime = $x[0].CreationTime.TimeOfDay.TotalMinutes + 5  # <-Intervalin Minutes
    
    Write-Host "Base Time in Minutes: $BaseTime"
    
    For ( $i = 1 ; $i -lt $cnt; $i++) {
    
       if ($x[$i].CreationTime.TimeOfDay.TotalMinutes -lt $BaseTime) {
    
         Write-Host `
           "$($X[$i].CreationTime.TimeOfDay.TotalMinutes) Delete File: $($X[$i].name)"
    
    #     Remove-Item -Path $x[$i].FullName
       }
       Else {
         $BaseTime = $x[$i].CreationTime.TimeOfDay.TotalMinutes + 5   #Increment Timer
         Write-Host "New Base Time in Minutes: $BaseTime"
    
       }
    }
    If you've never run PowerShell before see this post.

    As the code stands it will NOT delete any files so you can test it to see if it meets your needs. Once you are sure it works for you just remove the # in front of the Remove-Item line. The # is the comment operator in PS so if you want to get rid of some of the verboseness in the code you can place a # in front of the Write-Host items.

    Here's my Testing Info:
    Code:
    Test Files:
    
    754        Test-IsAdmin.ps1
    811       Elevator.zip
    816      PS-Functions-Wired-Wireless.ps1   ** Should be deleted **
    817     QueryLocalAdmin.ps1
    826     elevation_header.zip
    1007    PSRemoteSwitch.ps1
    1045    DiskSpaceGUI.ps1
    
    Test Run:
    
    Base Time in Minutes: 698.676622053333
    New Base Time in Minutes: 759.159754561667
    New Base Time in Minutes: 816.367108975
    816.19518234 Delete File: PS-Functions-Wired-Wireless.ps1
    New Base Time in Minutes: 822.346577851667
    New Base Time in Minutes: 831.463886478333
    New Base Time in Minutes: 1011.51354087833
    New Base Time in Minutes: 1049.70384666167
    The code can be changed to allow you to pick the directory from a browse list. I'll be glad to do this for you if the base code meets your needs.

    HTH
    Attached Files Attached Files

  11. #11
    WS Lounge VIP
    Join Date
    Dec 2009
    Location
    Earth
    Posts
    8,191
    Thanks
    48
    Thanked 985 Times in 915 Posts
    Do you get an output similar to RG's? Can you post a sample?

    cheers, Paul

  12. #12
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Yossi,

    I added some code to count kept & deleted files and tested w/your data.

    Code:
    Test Run w/your data:
    
    Enter Folder Date in YYYY-MM-DD format: 2015-01-19
    Base Time in Minutes: 451.466666666667
    451.033333333333 Delete File: 07.31.02.312.png
    New Base Time in Minutes: 461.133333333333
    458.866666666667 Delete File: 07.38.52.3852.png
    New Base Time in Minutes: 469.866666666667
    New Base Time in Minutes: 474.933333333333
    New Base Time in Minutes: 479.933333333333
    New Base Time in Minutes: 484.966666666667
    480.033333333333 Delete File: 08.00.02.02.png
    480.1 Delete File: 08.00.07.07.png
    480.2 Delete File: 08.00.12.012.png
    480.266666666667 Delete File: 08.00.17.017.png
    480.366666666667 Delete File: 08.00.22.022.png
    480.433333333333 Delete File: 08.00.27.027.png
    480.533333333333 Delete File: 08.00.32.032.png
    480.6 Delete File: 08.00.37.037.png
    480.7 Delete File: 08.00.42.042.png
    480.766666666667 Delete File: 08.00.47.047.png
    480.866666666667 Delete File: 08.00.52.052.png
    480.966666666667 Delete File: 08.00.57.057.png
    481.033333333333 Delete File: 08.01.02.12.png
    481.1 Delete File: 08.01.07.17.png
    481.2 Delete File: 08.01.12.112.png
    481.3 Delete File: 08.01.17.117.png
    481.366666666667 Delete File: 08.01.22.122.png
    481.433333333333 Delete File: 08.01.27.127.png
    481.533333333333 Delete File: 08.01.32.132.png
    481.666666666667 Delete File: 08.01.37.137.png
    481.733333333333 Delete File: 08.01.42.142.png
    481.833333333333 Delete File: 08.01.47.147.png
    481.933333333333 Delete File: 08.01.57.157.png
    482.033333333333 Delete File: 08.02.02.22.png
    482.1 Delete File: 08.02.07.27.png
    482.2 Delete File: 08.02.12.212.png
    482.3 Delete File: 08.02.17.217.png
    482.366666666667 Delete File: 08.02.22.222.png
    482.433333333333 Delete File: 08.02.27.227.png
    482.533333333333 Delete File: 08.02.32.232.png
    482.6 Delete File: 08.02.37.237.png
    482.7 Delete File: 08.02.42.242.png
    482.766666666667 Delete File: 08.02.47.247.png
    482.866666666667 Delete File: 08.02.52.252.png
    482.966666666667 Delete File: 08.02.57.257.png
    483.033333333333 Delete File: 08.03.02.32.png
    483.1 Delete File: 08.03.07.37.png
    483.2 Delete File: 08.03.12.312.png
    483.266666666667 Delete File: 08.03.17.317.png
    483.433333333333 Delete File: 08.03.27.327.png
    483.533333333333 Delete File: 08.03.32.332.png
    483.6 Delete File: 08.03.37.337.png
    483.7 Delete File: 08.03.42.342.png
    483.766666666667 Delete File: 08.03.47.347.png
    483.933333333333 Delete File: 08.03.57.357.png
    484.033333333333 Delete File: 08.04.02.42.png
    484.1 Delete File: 08.04.07.47.png
    484.2 Delete File: 08.04.12.412.png
    484.433333333333 Delete File: 08.04.27.427.png
    484.533333333333 Delete File: 08.04.32.432.png
    484.666666666667 Delete File: 08.04.37.437.png
    484.733333333333 Delete File: 08.04.42.442.png
    484.8 Delete File: 08.04.47.447.png
    484.866666666667 Delete File: 08.04.52.452.png
    484.933333333333 Delete File: 08.04.57.457.png
    New Base Time in Minutes: 490.033333333333
    485.266666666667 Delete File: 08.05.17.517.png
    485.366666666667 Delete File: 08.05.22.522.png
    485.433333333333 Delete File: 08.05.27.527.png
    485.533333333333 Delete File: 08.05.32.532.png
    485.6 Delete File: 08.05.37.537.png
    485.7 Delete File: 08.05.42.542.png
    485.8 Delete File: 08.05.47.547.png
    485.866666666667 Delete File: 08.05.52.552.png
    486 Delete File: 08.05.57.557.png
    486.066666666667 Delete File: 08.06.02.62.png
    486.133333333333 Delete File: 08.06.07.67.png
    486.4 Delete File: 08.06.22.622.png
    486.5 Delete File: 08.06.27.627.png
    486.566666666667 Delete File: 08.06.32.632.png
    486.666666666667 Delete File: 08.06.37.637.png
    486.766666666667 Delete File: 08.06.42.642.png
    486.833333333333 Delete File: 08.06.47.647.png
    486.933333333333 Delete File: 08.06.52.652.png
    487 Delete File: 08.06.57.657.png
    487.1 Delete File: 08.07.02.72.png
    487.166666666667 Delete File: 08.07.07.77.png
    487.266666666667 Delete File: 08.07.12.712.png
    487.3 Delete File: 08.07.17.717.png
    487.366666666667 Delete File: 08.07.22.722.png
    487.466666666667 Delete File: 08.07.27.727.png
    487.533333333333 Delete File: 08.07.32.732.png
    487.633333333333 Delete File: 08.07.37.737.png
    487.7 Delete File: 08.07.42.742.png
    487.766666666667 Delete File: 08.07.47.747.png
    487.866666666667 Delete File: 08.07.52.752.png
    487.933333333333 Delete File: 08.07.57.757.png
    488.033333333333 Delete File: 08.08.02.82.png
    488.1 Delete File: 08.08.07.87.png
    488.2 Delete File: 08.08.12.812.png
    488.266666666667 Delete File: 08.08.17.817.png
    488.366666666667 Delete File: 08.08.22.822.png
    488.433333333333 Delete File: 08.08.27.827.png
    488.533333333333 Delete File: 08.08.32.832.png
    489.033333333333 Delete File: 08.09.02.92.png
    489.1 Delete File: 08.09.07.97.png
    489.2 Delete File: 08.09.12.912.png
    489.266666666667 Delete File: 08.09.17.917.png
    489.366666666667 Delete File: 08.09.22.922.png
    489.533333333333 Delete File: 08.09.32.932.png
    489.633333333333 Delete File: 08.09.37.937.png
    New Base Time in Minutes: 501.6
    496.7 Delete File: 08.16.42.1642.png
    496.766666666667 Delete File: 08.16.47.1647.png
    New Base Time in Minutes: 513.933333333333
    509.033333333333 Delete File: 08.29.02.292.png
    509.1 Delete File: 08.29.07.297.png
    509.2 Delete File: 08.29.12.2912.png
    509.266666666667 Delete File: 08.29.17.2917.png
    509.366666666667 Delete File: 08.29.22.2922.png
    509.433333333333 Delete File: 08.29.27.2927.png
    509.533333333333 Delete File: 08.29.32.2932.png
    509.6 Delete File: 08.29.37.2937.png
    509.7 Delete File: 08.29.42.2942.png
    509.766666666667 Delete File: 08.29.47.2947.png
    509.866666666667 Delete File: 08.29.52.2952.png
    509.933333333333 Delete File: 08.29.57.2957.png
    510.033333333333 Delete File: 08.30.02.302.png
    510.1 Delete File: 08.30.07.307.png
    510.2 Delete File: 08.30.12.3012.png
    510.266666666667 Delete File: 08.30.17.3017.png
    510.533333333333 Delete File: 08.30.32.3032.png
    510.6 Delete File: 08.30.37.3037.png
    510.7 Delete File: 08.30.42.3042.png
    510.766666666667 Delete File: 08.30.47.3047.png
    510.866666666667 Delete File: 08.30.52.3052.png
    510.933333333333 Delete File: 08.30.57.3057.png
    511.033333333333 Delete File: 08.31.02.312.png
    511.1 Delete File: 08.31.07.317.png
    511.2 Delete File: 08.31.12.3112.png
    511.266666666667 Delete File: 08.31.17.3117.png
    511.366666666667 Delete File: 08.31.22.3122.png
    511.433333333333 Delete File: 08.31.27.3127.png
    511.533333333333 Delete File: 08.31.32.3132.png
    511.6 Delete File: 08.31.37.3137.png
    511.7 Delete File: 08.31.42.3142.png
    511.766666666667 Delete File: 08.31.47.3147.png
    511.866666666667 Delete File: 08.31.52.3152.png
    511.933333333333 Delete File: 08.31.57.3157.png
    512.1 Delete File: 08.32.07.327.png
    512.2 Delete File: 08.32.12.3212.png
    512.266666666667 Delete File: 08.32.17.3217.png
    512.366666666667 Delete File: 08.32.22.3222.png
    512.433333333333 Delete File: 08.32.27.3227.png
    512.533333333333 Delete File: 08.32.32.3232.png
    512.6 Delete File: 08.32.37.3237.png
    512.7 Delete File: 08.32.42.3242.png
    512.766666666667 Delete File: 08.32.47.3247.png
    512.866666666667 Delete File: 08.32.52.3252.png
    513 Delete File: 08.32.57.3257.png
    513.033333333333 Delete File: 08.33.02.332.png
    513.133333333333 Delete File: 08.33.07.337.png
    513.233333333333 Delete File: 08.33.12.3312.png
    513.3 Delete File: 08.33.17.3317.png
    513.4 Delete File: 08.33.22.3322.png
    513.5 Delete File: 08.33.27.3327.png
    513.566666666667 Delete File: 08.33.32.3332.png
    513.666666666667 Delete File: 08.33.37.3337.png
    513.766666666667 Delete File: 08.33.42.3342.png
    513.833333333333 Delete File: 08.33.47.3347.png
    513.9 Delete File: 08.33.52.3352.png
    New Base Time in Minutes: 519
    514.033333333333 Delete File: 08.34.02.342.png
    514.133333333333 Delete File: 08.34.07.347.png
    514.2 Delete File: 08.34.12.3412.png
    514.3 Delete File: 08.34.17.3417.png
    514.366666666667 Delete File: 08.34.22.3422.png
    514.466666666667 Delete File: 08.34.27.3427.png
    514.533333333333 Delete File: 08.34.32.3432.png
    514.6 Delete File: 08.34.37.3437.png
    514.7 Delete File: 08.34.42.3442.png
    514.766666666667 Delete File: 08.34.47.3447.png
    514.866666666667 Delete File: 08.34.52.3452.png
    514.933333333333 Delete File: 08.34.57.3457.png
    515.033333333333 Delete File: 08.35.02.352.png
    515.1 Delete File: 08.35.07.357.png
    515.2 Delete File: 08.35.12.3512.png
    515.266666666667 Delete File: 08.35.17.3517.png
    515.6 Delete File: 08.35.37.3537.png
    515.7 Delete File: 08.35.42.3542.png
    515.766666666667 Delete File: 08.35.47.3547.png
    515.933333333333 Delete File: 08.35.57.3557.png
    516.033333333333 Delete File: 08.36.02.362.png
    516.1 Delete File: 08.36.07.367.png
    516.2 Delete File: 08.36.12.3612.png
    516.266666666667 Delete File: 08.36.17.3617.png
    516.366666666667 Delete File: 08.36.22.3622.png
    516.433333333333 Delete File: 08.36.27.3627.png
    516.533333333333 Delete File: 08.36.32.3632.png
    516.6 Delete File: 08.36.37.3637.png
    516.7 Delete File: 08.36.42.3642.png
    516.766666666667 Delete File: 08.36.47.3647.png
    Results: Remaining Files: 10
             Deleted   Files: 190
    Here's a picture of the directory after the program was run:
    YossiTest.JPG

    Here's the revised code with the counters:
    Code:
    $FldDate = Read-Host "Enter Folder Date in YYYY-MM-DD format"
    
    
    If ($FldDate -eq "") {
      Write-Host "No Folder Name/Date provides...Exiting!"
      Exit
    }
    Else {
           If (-Not (Test-Path -Path "G:\Test\Snapshots\$($FldDate)\*.*")) {
             Write-Host `
    @("Folder: G:\Test\Snapshots\$($FldDate)`
    Does not exist or is empty! ... Exiting ...")
             Exit
           } #End IF (Test-Path...
    }
    
    $x = Get-ChildItem -Path "G:\Test\Snapshots\$($FldDate)\*.*" |
         Sort-Object CreationTime
    
    $ErasedFilesCnt = 0
    $KeptFilesCnt    = 1
    $Cnt                 = $x.Count
    
    $BaseTime = $x[0].CreationTime.TimeOfDay.TotalMinutes + 5  # <-Intervalin Minutes
    
    Write-Host "Base Time in Minutes: $BaseTime"
    
    For ( $i = 1 ; $i -lt $cnt; $i++) {
    
       if ($x[$i].CreationTime.TimeOfDay.TotalMinutes -lt $BaseTime) {
    
         Write-Host `
           "$($X[$i].CreationTime.TimeOfDay.TotalMinutes) Delete File: $($X[$i].name)"
    
         Remove-Item -Path $x[$i].FullName
    
          $ErasedFilesCnt += 1
       }
       Else {
    
         $BaseTime = $x[$i].CreationTime.TimeOfDay.TotalMinutes + 5   #Increment Timer
         Write-Host "New Base Time in Minutes: $BaseTime"
         $KeptFilesCnt += 1
    
       }
    
    }   #End For ( $i...
    
    @("Results: Remaining Files: $($KeptFIlesCnt)
             Deleted   Files: $($ErasedFilesCnt)")
    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  13. #13
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Yossi,

    I figured out the problem you were having. You copied one of your directories for the test like I suggested right? Well this was your downfall and my fault. Copying the files changed the Created Dates! So only the first file would be saved. Here's a sample of your data after I copied the files to another directory:
    YossiCOpied.JPG

    When you posted a Zipped directory those files maintain their Created Date through the Zip/UnZip cycle thus it worked just fine in my test above because I never COPIED the files.

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •