Quantcast
Channel: PowerShell
Viewing all articles
Browse latest Browse all 15370

Powershell Script

$
0
0

I am trying to get a working PS script that backs up most recent data dating back to 15 days, I want to have it scheduled to run every 15 days. I am backing up .tiff images but they are created daily in structured folders with a date on each folder. After the 15 days, I want to delete the backed up data so that its all new data every 15 days.

Writing this, I think it's easier to run it daily to backup and delete data 15 days back, so every day it deletes and copies only 1 day.


Who can help me with this task? This is what I got so far..


Powershell
Functioncopy{#Moves all files Newer than 15 days old from the Source folder to the TargetGet-Childitem-Path"C:\Files\Folder\"|Where-Object{$_.LastWriteTime-gt(get-date).AddDays(-15)}|ForEach{Copy-Item$_.FullName-destination"\\MTS.dom\Test\"-force-ErrorAction:...

Viewing all articles
Browse latest Browse all 15370

Latest Images

Trending Articles



Latest Images

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