locked
Batch Documnet control Help RRS feed

  • Question

  • I have been utilizing Robocopy to copy files from a shared drive to a folder for documents Due on my desktop. It is using Date last modified to copy these files that are older than 100 days. The problem is these files sometimes get modified with digital signatures but I still need the file to be copied when the Document is older than 100 days. I was hoping there was a way to use the date in the filename instead of the modified date. All the naming conventions are the same format..

    INV-XXXXX-Quarterly-YDDD The "YDDD" is the Julian date. Example INV-123SS-Quarterly-5007, That would be 7 Jan 2015.

    Here is what i have been using.

    robocopy X:\02-02" - Accounts" C:\Users\1385741622A\Desktop\Backups /Minage:100 /Maxage:160 INV-*****-Quarterly-* /s 
    pause

    Wednesday, January 7, 2015 8:36 PM

Answers

  • To specify any date you want, put it in quotes right after get-date. For example:


    (get-item "C:\path\filename.ext").LastWriteTime = (get-date "3/15/2014 4:23pm")


    -- Bill Stewart [Bill_Stewart]

    • Marked as answer by Amber Rees Wednesday, January 7, 2015 10:47 PM
    Wednesday, January 7, 2015 10:46 PM

All replies

  • So what's your question? (What is your robocopy command not doing that it should do?)

    -- Bill Stewart [Bill_Stewart]

    Wednesday, January 7, 2015 8:47 PM
  • The robocopy is working. I was hoping there was a way to have it look at the julian date in the filename instead of modified date.
    Wednesday, January 7, 2015 8:52 PM
  • Why?

    -- Bill Stewart [Bill_Stewart]

    Wednesday, January 7, 2015 8:59 PM
  • Well I need these files pulled when they hit the age of 100 days and in most cases this works with the date last modified but occasionally that date is incorrect. I didnt see anything in the robocopy commands that look like i can do this but i was hoping. 

    Wednesday, January 7, 2015 9:02 PM
  • How could the date be incorrect? The last modification date/time of the file is the date/time it was last modified.


    -- Bill Stewart [Bill_Stewart]

    Wednesday, January 7, 2015 9:14 PM
  •  yes but for some reason when a couple of these files were moved it changed the date from the day it was digitally signed. so they are over their 100 days but robocopy now will not copy them because of this. so i now have overdue signatures. i know its really tedious but as of right now i have to check dates manually.

     
    Wednesday, January 7, 2015 9:18 PM
  • What changed the date? (What is the antecedent to the pronoun "it" in the phrase "it changed the date")?


    -- Bill Stewart [Bill_Stewart]

    Wednesday, January 7, 2015 9:21 PM
  • "It" would be the way the file was moved. perhaps it was copied from a separate location and that process or something similar changed the modified date.

    Wednesday, January 7, 2015 10:24 PM
  • Normal file copying processes don't change the last modification date/time, unless copied from a file system that is not as granular as NTFS (such as old FAT, which can be up to 2 seconds different).

    In the case where a file should have a more recent date but doesn't, you can use the following command from a PowerShell window to update its last modification date/time to now:


    (get-item "C:\path\filename.ext").LastWriteTime = (get-date)
    

    Of course, substitute "C:\path\filename.ext" with the actual name of the file.

    -- Bill Stewart [Bill_Stewart]

    Wednesday, January 7, 2015 10:33 PM
  • So with power shell the (get-date) i could use the same date that is contained in the filename? or will it only stamp the modified date as today?
    Wednesday, January 7, 2015 10:38 PM
  • To specify any date you want, put it in quotes right after get-date. For example:


    (get-item "C:\path\filename.ext").LastWriteTime = (get-date "3/15/2014 4:23pm")


    -- Bill Stewart [Bill_Stewart]

    • Marked as answer by Amber Rees Wednesday, January 7, 2015 10:47 PM
    Wednesday, January 7, 2015 10:46 PM
  • Thank you for the help Bill.
    Wednesday, January 7, 2015 10:47 PM