FileSystemTools/FileSystemTools.ps1
function Copy-DirectoryContent($SourceFolder, $Destination = './') { if (-Not(Test-Path $Destination)) { New-Item -Path $Destination -ItemType Directory } Get-ChildItem -Path $SourceFolder | Copy-Item -Destination $Destination -Recurse } function Update-FileContent($FilePath, $SearchString, $RenameToString) { ((Get-Content -path $FilePath) -replace $SearchString, $RenameToString) | Set-Content -Path $FilePath } function NewContainerSharedTempDirectory($ContainerName) { $sharedPaths = Get-NavContainerSharedFolders -containerName $ContainerName $objectsTempPath = Join-Path -Path ($sharedPaths.Keys.Split(" ")[0]) -ChildPath ([guid]::NewGuid()) $tempDir = New-Item $objectsTempPath -ItemType Directory return $tempDir } function IsDirectory($Path) { return Test-Path -Path $Path -PathType Container } function NewTempFile() { $tempFilePath = Join-Path -Path (GetTempDirectory) -ChildPath "$(GenerateGuid).txt" return New-Item -Path $tempFilePath -ItemType File } function GetTempDirectory() { return $env:TEMP } function GenerateGuid() { return [guid]::NewGuid(); } |