i have some problems to find a good way to handle this, maby someone have
Short and simple description:
I have 2 folders. A destination folder and a source folder.
The main task is to copy interactively selectable files (via out-GridView) from one folder to another, but with some dependencies.
There is a source folder structure and a target folder structure which are structured in the same way.
With a configuration file, folders and files are made dependent. There is always a leading folder and dependent folders for a folder.
There are one or more leading folders (source) from which data can be selected via Out-GridView. There are more dependent folders in the source per leading folder from which the user cannot select anything.
All folders in the source that are dependent on a leading folder contain files with the same name but different extensions.
If the user has selected files from the leading folder using Out-GridView, all files with the same name but different extensions should also be copied from the source to the target folders .
The structure of the source folder is the same as that of the destination folder. If a folder does not exist, it will be created automatically.
In order to make only certain files available for selection, a control file is used for this task, in which the following parameters are stored per line. A Configuration file can have leading folders with dependencies but leading folder / dependencies are stored allwas per line. New line means different folder wit other dependancies
<Main Folder name\File extension> <second dependent folder File extension with condition MUST or Can be copied> <further dependent folder File extension with condition MUST or Can be copied>
Folders Source (Example):
- SRC (Leading)
- DLL (depending on SRC)
- JPG (depending on SRC)
- WRD (Leading)
- EXC (depending on WRD)
- VISIO (depending on WRD
|Leading Foldername\Extension||Dependent Folder 1||Musst or Can be copied||Dependent Folder X||Musst or can be copied|
Only the files from the leading folder are selectable. All dependent files are copied to the target folder in the background automatically
First line of the config file processing
The script opens now the path to the first entry “Src” and get all items from this folder with the *.c file extension. Out-Gridview lets the user select some files if files were found with the extension (from src with *.c). The user select file abc.c efg.c and xxx.c and klick on ok.
The scrip now search for all files in the folders “dll” AND “jpg” and get all items from this folder with the same names of the pre selected files (abc efg and xxx ) but now with the .dll and .jpg extension (abc.dll efg.dll, xxx.dll,abc.jpg, efg.jpg, xxx.jpg)and copied this files and the leading files (abc.c efg.c and xxx.c ) directly to the target folder (src and dll and jpg folders) without further interaction. The user can only select files from the leading Folder.
Must or can means only if the copy job failes and the config file have for this file type a “M” then the script should stop, if “C” then the issue sould be logt but the script should continue running.
The script works through the configuration file lines.
Per line the above described procedure is repeated.
I am not sure how to structure the config file and also i have right now not realy a idee how to code the script .
So, the main problem is how to define the config file (json? xml? or with delimiter? working with arrays?)
Thanks for any idea