Path format - 7k2mpa/FileMaintenace GitHub Wiki

Summary

The scripts can accept 3 type path formats.

  • Absolute path
  • Relative path
  • UNC path

Detail and samples

Sample path

D:\infra\script\FileMaintenance.ps1
D:\infra\script\oldlogs\
D:\infra\log\

Absolute path

Starting with drive letter and path strings.

PS> .\FileMaintenance.ps1 -TargetFolder D:\infra\log

Relative path

In the scripts specify relative path must start with dot, must not start with name of path or file. If you specify path in relative path format, the starting path is not current path but is path of the script placed.

PS> .\FileMaintenance.ps1 -TargetFolder ..\log

You can not specify the path starting with a folder name.

Do not

PS> .\FileMaintenance.ps1 -TargetFolder oldlogs

Specify the path starting with dot.

Do

PS> .\FileMaintenance.ps1 -TargetFolder .\oldlogs

UNC path

Starting with hostname and path strings.

PS> .\FileMaintenance.ps1 -TargetFolder \\server\log

Windows allows multiple separetors in path strings and you can specify, but the scripts normalize path format automatically.