every day a server saves data on a SMB Share by creating a new folder.
In this SMB Share we've 3 or 4 folders, and the retention of these is managed by the server that saves the data.
With Veeam I do a "File-to-Backup" every day and I extend the Retention to two weeks.
On the first day of each month I've to put this data on a Tape, and I wouldn't want to take all 3 (or 4) folders. Because now they are small, but in the future we'll also reach 1 TB for each.
I therefore thought of using "Pre" and "Post" scripts the "File-to-Tape", where I look for the last folder created and rename it in a name (the same every month) which I'll then insert in the job.
By doing so I no longer have to do anything at the level of the "File-to-Tape" job, nor in the folders.
Finished the saving on tape, I've to rename the folder putting back the original name. This is because, as written above, retention is managed by the server, or rather by the script that generates these folders.
Something I found but it doesn't work.
PRE command to write the folder name to a file
PRE command to rename the folder$ latest = Get-ChildItem | sort CreationTime -desc | select -f 1 | ft name -hide | Out-File -FilePath "D: \ scripts \ latest.txt"
POST commands to read the folder name from the file$ latest = Get-ChildItem | sort CreationTime -desc | select -f 1 | ft name -hide | Rename-Item -NewName {$ _. BaseName -replace 'MONTHLY'}
POST command to rename the folder$ latest = Get-Content -Raw "D: \ scripts \ latest.txt" | where {$ _ -ne ""}
similar to the PRE
Maybe there is no need to do all these movements because there is another system, but I've not found it.
Thank's in advance for the Help.
Kind regards