I am using PS script to import file to servicenow and want your expect help with some tweak with below: Sample using currently in PS:
# Specify endpoint uri
$uri = "https://instance.service-now.com/api/now/attachment/file?table_name=sys_data_source&table_sys_id=176ada0f1ba89950f03fa861f54bcbe6&file_name=Amit_2022_09_07_12_12_0002.csv"
# Specifiy file to attach
$fileToAttach = "C:\Amit\Amit_2022_09_07_12_12_0002.csv"
My requirement is :
- Expecting every 10 mins one new file in folder C:\Amit, so once last one processed, It should move to another folder called C:\Amit\Processed and latest should pick.
Or. 2. Last processed file should move and we will have only new file to process so that can be pick.
Note: File name (Amit_2022_09_07_12_12_0002.csv) is not constant, means date and time will be changing in newly received file in folder.
I will be truly grateful if you can help with his PS script.