Thanks for your assictance. Really appreciate it. In terms of running the script every hours, but reseting the increments each day, this makes sense as I could configure a scheduled task to run the script each day, but put a condition in to kill the script at the end of each day.
I downloaded the PSFTP module which contains Get-FTPChildItem from the https://gallery.technet.microsoft.com/scriptcenter/ repository.
https://gallery.technet.microsoft.com/scriptcenter/PowerShell-FTP-Client-db6fe0cb
Did you want to see the help?
NAME
Get-FTPChildItem
SYNOPSIS
Gets the item and child items from ftp location.
SYNTAX
Get-FTPChildItem [[-Path] ] [[-Session] ] [-Recurse] [[-Depth] <Int
[[-Filter] ] [-WhatIf] [-Confirm]
DESCRIPTION
The Get-FTPChildItem cmdlet gets the items from ftp locations. If the item is a
container, it gets the items inside the container, known as child items.
PARAMETERS
-Path
Specifies a path to ftp location or file.
Required? false
Position? 1
Default value
Accept pipeline input? true (ByValue, ByPropertyName)
Accept wildcard characters? false
-Session
Specifies a friendly name for the ftp session. Default session name is
'DefaultFTPSession'.
Required? false
Position? 2
Default value DefaultFTPSession
Accept pipeline input? false
Accept wildcard characters? false
-Recurse []
Get recurse child items.
Required? false
Position? named
Default value False
Accept pipeline input? true (ByPropertyName)
Accept wildcard characters? false
-Depth
Define depth of folder in recurse mode. Autoenable recurse mode.
Required? false
Position? 3
Default value 0
Accept pipeline input? false
Accept wildcard characters? false
-Filter
Specifies a filter parameter to return only this objects that have proper name.
parameter allow to use of wildcards. Defalut value is *.
Required? false
Position? 4
Default value *
Accept pipeline input? false
Accept wildcard characters? false
-WhatIf []
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Confirm []
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, see
about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
PSFTP.Item
NOTES
Author: Michal Gajda
Blog : http://commandlinegeeks.com/
-------------------------- EXAMPLE 1 --------------------------
PS P:\>Get-FTPChildItem -path ftp://ftp.contoso.com/folder
Parent: ftp://ftp.contoso.com/folder
Dir Right Ln User Group Size ModifiedDate Name
--- ----- -- ---- ----- ---- ------------ ----
d rwxr-xr-x 3 ftp ftp 2012-06-19 12:58:00 subfolder1
d rwxr-xr-x 2 ftp ftp 2012-06-19 12:58:00 subfolder2
- rw-r--r-- 1 ftp ftp 1KB 2012-06-15 12:49:00 textitem.txt
-------------------------- EXAMPLE 2 --------------------------
PS P:\>Get-FTPChildItem -path ftp://ftp.contoso.com/folder -Filter "subfolder*"
Parent: ftp://ftp.contoso.com/folder
Dir Right Ln User Group Size ModifiedDate Name
--- ----- -- ---- ----- ---- ------------ ----
d rwxr-xr-x 3 ftp ftp 2012-06-19 12:58:00 subfolder1
d rwxr-xr-x 2 ftp ftp 2012-06-19 12:58:00 subfolder2
-------------------------- EXAMPLE 3 --------------------------
PS P:\>Get-FTPChildItem -path folder -Recurse
Parent: ftp://ftp.contoso.com/folder
Dir Right Ln User Group Size ModifiedDate Name
--- ----- -- ---- ----- ---- ------------ ----
d rwxr-xr-x 3 ftp ftp 2012-06-19 12:58:00 subfolder1
d rwxr-xr-x 2 ftp ftp 2012-06-19 12:58:00 subfolder2
- rw-r--r-- 1 ftp ftp 1KB 2012-06-15 12:49:00 textitem.txt
Parent: ftp://ftp.contoso.com/folder/subfolder1
Dir Right Ln User Group Size ModifiedDate Name
--- ----- -- ---- ----- ---- ------------ ----
d rwxr-xr-x 2 ftp ftp 2012-06-19 12:58:00 subfolder11
- rw-r--r-- 1 ftp ftp 21KB 2012-06-19 09:20:00 test.xlsx
- rw-r--r-- 1 ftp ftp 14KB 2012-06-19 11:27:00 ziped.zip
Parent: ftp://ftp.contoso.com/folder/subfolder1/subfolder11
Dir Right Ln User Group Size ModifiedDate Name
--- ----- -- ---- ----- ---- ------------ ----
- rw-r--r-- 1 ftp ftp 14KB 2012-06-19 11:27:00 ziped.zip
Parent: ftp://ftp.contoso.com/folder/subfolder2
Dir Right Ln User Group Size ModifiedDate Name
--- ----- -- ---- ----- ---- ------------ ----
- rw-r--r-- 1 ftp ftp 1KB 2012-06-15 12:49:00 textitem.txt
- rw-r--r-- 1 ftp ftp 14KB 2012-06-19 11:27:00 ziped.zip
-------------------------- EXAMPLE 4 --------------------------
PS P:\>$ftpFile = Get-FTPChildItem -path /folder/subfolder1/test.xlsx
PS P:\> $ftpFile | Select-Object Parent, Name, ModifiedDate
Parent Name
ModifiedDate
------ ----
------------
ftp://ftp.contoso.com/folder/subfolder1 test.xlsx
2012-06-19 09:20:00
RELATED LINKS
Set-FTPConnection