Announcement

Collapse
No announcement yet.

Script to move files created 24 hours before

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Script to move files created 24 hours before

    Hi,

    I need some help with scripting. I need to create a script to run at 11.00 PM that checks two folders, if the date created of the files is before 11.00PM of the previous day the files in these folders are moved to another folder {Archive}. The files will overwrite the existing files with same name.

    Thanks for your help

    Sue

  • #2
    Re: Script to move files created 24 hours before

    Not knowing the operating system or scripting language makes it a bit difficult, but my friend Mr has a lot of suggestions:

    https://www.google.co.uk/search?q=sc...KuWR0AWCoIDQBg
    Tom Jones
    MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
    PhD, MSc, FIAP, MIITT
    IT Trainer / Consultant
    Ossian Ltd
    Scotland

    ** Remember to give credit where credit is due and leave reputation points where appropriate **

    Comment


    • #3
      Re: Script to move files created 24 hours before

      Thanks, created script with Windows Powershell

      get-childitem -Path "F:\TEST","F:\TEST2" -recurse | where-object {$_.LastWriteTime -le (get-date).AddHours(-15)} | move-item -destination "F:\TEST3" -force

      Comment


      • #4
        Re: Script to move files created 24 hours before

        Well done, and thanks for posting back the solution
        Tom Jones
        MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
        PhD, MSc, FIAP, MIITT
        IT Trainer / Consultant
        Ossian Ltd
        Scotland

        ** Remember to give credit where credit is due and leave reputation points where appropriate **

        Comment

        Working...
        X