Powershell file name manipulation based on SQL query
€250-750 EUR
已完成
已发布超过 3 年前
€250-750 EUR
货到付款
Our company is photographing products for webshop, at that point picture is taken the EAN13 barcode of the product read and then picture files are named as [EAN13]-1 , [EAN13]-2, [EAN13]-3 etc. into one folder (EAN13-folder), depending on how many pictures were taken.
In the end the picture files will saved into another folder (ERP-folder) and named based on the product code in ERP system.
So [ERP product code]-1
If there already are pictures for that product code in the (ERP-folder), then the name should [ERP product code]-X where X stand for the number of picture (in the folder there were already 3 pictures for the product, then X would be 4)
Script is needed to:
- read the contents of EAN13-folder,
- move affected picture files into another working folder
- do a SQL query looking into a table, where results would have:
[EAN13]
[ERP product code]
- rename the picture files in working folder according to ERP product codes
- look into the final output folder (ERP-folder) if previous pictures with same [ERP product code] exist and then give the [ERP product code]-X filename where X is the groving number
- the script needs to be able to handle multiple pictures of the same item; eg. [EAN13]-1 , [EAN13]-2, [EAN13]-3 to [ERP product code]-5, [ERP product code]-6, [ERP product code]-7
- the script needs to be able to handle cases where the SQL query does not return any data for the EAN13. Such files could stay in the working folder and wait for next run
- the script needs to write daily [date][login to view URL] where number of succesfully processed picture files is written for each run, and each failed picture file with name is mentioned
- the script needs to have parameters for all folder locations, SQL query, SQL access rights etc.
The script will be scheduled to run every 60 minutes (outside the script, probably plainly windows scheduler with needed user credentials)