Quantcast
Channel: SQLServerCentral » Programming » Powershell » Latest topics
Viewing all articles
Browse latest Browse all 467

Ideas to monitor file copying progress for automated script

$
0
0
I have a PS script that runs on a schedule.This process is automated and the app that calls the PS script is a service that does not have admin privileges.This script looks in a certain folder for any files in that folder. If files are found, do *magic*, move files to SFTP folder, when all files have fully copied to SFTP folder copy over a control file to start the SFTP process.I can have 0-20 files with size ranges from a few KB to ~5GB.Due to internal bandwidth constraints, I want to move one file at a time to the SFTP folder. Any suggestions on best ways in PS to monitor if a file is still uploading or has finished uploading to a folder?I tried BITS Transfer module, but it appears that the user has to be logged in interactively or possibly as a privileged account . Unless I am totally mistaken, this won't work for what I was asked to build.I thought about writing a function (or while loop) to check if a given file is locked/unlocked or writing another set of code to check the file size every x seconds to see if the size has changed.Any other suggestions? Hoping MS has a CMDLET for this, but have not found it yet.Oh yeah, I am stuck with PS version 2.

Viewing all articles
Browse latest Browse all 467

Trending Articles