Two Tiny Python Scripts
I would need two short Python scripts that must both work on any version of Windows. Also on any upcoming version of Windows. Both must be done in Pyhton programming language only. Deadline is 1 day because they are, I believe so, very short.
As small file sample I added the attachment to this project description. Download it and take a look. Please do NOT anyhow share or show to anyone the txt file. This first script will always work on the exact file comparison.txt. Strictly only this file. It should NOT matter how many lines are inside. There can be only two, there can be tens of thousands, etc or the file could also be empty.
For this script is important everything what is in the file between FIRST line and between FIRST PREVIOUS line (which will most of times be blank line) from the following line (without the quotes):
"Added the (!!!!!)-tag to following folders:"
That means the script should ignore EVERYTHING what is AFTER mentoined line, including the actual mentioned line. Differently said: The script must only work with EVERYTHING what is BEFORE (!) mentoined line.
I will mentoin to the winning bidder the path to the folder where the script must work. The following 7 folders and their ENTIRE content must be 100% ignored (skipped):
A, B, C, D
E, F, G, H
I, J, K, L
M, N, O, P
Q, R, S, T
U, V, W, X
Y, Z, Any Other Symbols
So the script must work with every other folder in the path (once again, I will tell this folder path to the winning bidder) EXCEPT those 7 folders and their entire content.
It is very important that the script will work ONLY with FIRST NEXT folder depth (NOT the current one but only first next) from the folder path that I will say to the winning bidder. Lets call this path PATH1. So for example if I say the path: C:\XXX\YYY then the script will work on the third level folder depth only which can be: C:\XXX\YYY\QQQ but of course excluding previously mentioned 7 folders. Remember the folder depth and what it has to be excluded because the same folder depth and the same folders to be ignored are relevant also for second script.
What the script has to do is the following: It has to go through the file comparison.txt. Which part of the file is relevant to this script and what should be ignored in this file (=has nothing to do with this script) is already said above. I will tell the winning bidder where will be this file located. Lets call this path PATH2. No protection needed because file will always be there. So the script has to check in the file every single line (within relevant part of file of course) ''file:[url removed, login to view]'' without the quotes. Then it has to has to go to each of those folders. For example if it says near ''file:[url removed, login to view]'' without the quotes ''X\Y'' without the quotes then it has to go to X folder. All such folders are located in PATH1. Then the script needs to go to all folders that are located first next level depth deeper. Only first next level depth. In this case that would be the folder ''Y''. Each such folder must be further checked but only at the beginning where its foldername starts with ''['' without the quotes and '']'' without the quotes. Between those two brackets can be anything inside: numbers, words, symbols, mixes of them etc. For the folder is relevant only this starting positions of foldernames. Nothing else. I cannot guarantee that after '']'' without the quotes will always be one empty space. It might happen it won't. But I can guarantee there is 100% possibility (so no protection needed) that those subfolders (Y ones) will always BEGIN with ''['' without the quotes and '']'' without the quotes. For the script is only important START of each such subfolder. The rest of each foldername (whatever is after '']'' without the quotes) can be ignored because its not important. Always is only important the starting position of those two brackets because there might be later again, in the same name of the same folder, another two brackets. Those are no important anymore. Only first ones. So what the script has to do is find the match (again, its very important that 7 folders, named above, are really ignored and their entire content) with each of the folder that is near ''file:[url removed, login to view]'' without the quotes in the comparison.txt. Then it has to move the each Y folder into recycle bin. Thats all.
Be careful that the script ONLY work with the lines where it says ''file:[url removed, login to view]'' without the quotes. Nowhere else! Also be careful because it can happen that the content between ''['' and '']'' without the quotes is so big that it goes to the next line in txt too (same foldername in two lines in txt file). Make sure that script will work in such situation also.
If the Y folder (X\Y as an example in txt file) that was moved to recycle bin the only one in X folder (in this case the X is now empty) then move X folder to recycle bin too.
Same 7 folders, located on the same PATH1, must be ignored with their entire content. This script has nothing to do with txt file. So it shouldn't use it or try to use it.
Script should create the txt file in PATH2 (will tell it to winning bidder) with the name ''nc_result'' without the quotes. Script consist of two features:
It has to check whether any of the folder, located on the SAME level depth (PATH1) as 7 folders to be ignored are, has the name ''Not On Label'' (case insensitive) without a matter of how many words are near it. If I was understandable with level depth in previous script then you will know this level depth is now different. It also counts if ''Not On Label'' is between any kind of brackets (''['' or ''('' or '']'' or '')'' without the quotes). Those three words must be together. So if any of the foldernames has the name for example ''Not On This Label'' then this has nothing to do with the script. The script then has to report in txt file each of the folder that contains, in its name, ''Not On Label''. One folder per line in txt file. At the same time the same feature has to go one folder depth deeper. Now this is the same folder as where first script will work. Same first feature of same script (second one) also has to report in the txt file all folders AND subfolders in X\Y (Foldername\Subfoldername) layout where between starting ''['' and '']'' (only starting because in some folders might later in the name occur those two brackets again!!!) is only one word and exactly the following word (case insensitive) without the quotes: ''none''.
This is the ONLY condition where such folders\subfolders will be reported in the nc_result.txt. Nothing else.
After potential reporting (if something is found) the script should go to the second feature.
The same second script should report in the same [url removed, login to view] file the folders that ONLY have the differences (according to their names) in the following four subjects (case insensitive):
word ''rec'' without the quotes
word ''records'' without the quotes
word ''recordings'' without the quotes
name of ANY country
Always only counts if the word is placed as the LAST word in foldername. Except in situation when name of country such as ''Burkina Faso'' consist of more than one words. In this example it takes latest words.
name of countries can be find here: [url removed, login to view]
If you want to use any other list, feel free to do so but make sure the list will be completed with all possible countries on earth. Do NOT code the script to connect to this site because it can go either offline or change the URL. Instead, use all the names of countries in the code.
To be more understandable I will explain this second feature on five random chosen examples (all those folders case insensitive and all folders are in PATH1, the script should NEVER go searching one folder depth, to subfolder, deeper, that means this second feature is for folder depth located on the same level as 7 folders are that need to be ignored with their entire content):
Foldername: This Is Foldername1 Rec
Foldername: This Is Foldername1
In this example the difference is in word ''Rec'' which means it matches the second feature condition so script should report both foldernames.
Foldername: This is A Foldername1 Rec
Foldername: This is Foldername1
As you can see there is more than one difference of four mentoined possible differences. Exluding ''Rec'' foldernames are NOT the same and therefore it has nothing to do with this script. The script must NOT report anything.
Foldername: [bds87t3bf' Recordings
In this example the difference is in the word ''Recordings'' so the script should report both folders.
Foldername: Word1 Word2 Records Word3
Foldername: Word1 Word2 Word3
Since the word ''Records'' is NOT the last word, it doesn't count as a difference. Therefore is doesn't have anything to do with the script and this example must NOT be reported.
Foldername: Abc Bde web 023--_
Foldername: Abc Bde WEB 023--_ Tanzania
Previously I mentoined the folders are case insensitive. Therefore, exluding ''Tanzania'', without the quotes, those two foldernames have the same name. The only difference is the name of the country (Tanzania). So it matches the four possible differences and therefore both foldernames should be reported. I chose this country in the example totally randomely.
When adding/pasting name of websites, add/paste manually also ''USA'' and ''UK'' without the quotes as abbreviation. Also leave full names (United States of America, United Kingdom) in the list.
Layout of [url removed, login to view] should look like this:
Not On Label list (one per line)
None list (Folder\Subfolder so I know instantly to which folder does subfolder belong, one per line)
where X and Y are the folders found by second script's second feature. The three dashes are there so I can know instantly between which two folders is the difference. Note that many times it can happen that those two foldernames will have longer length and therefore ''X---Y'' will be in two lines and not just one.
If something (for example no folder on exact folder depth contain ''none'' near starting ''['' and '']'' without the quotes) isn't found then skip that line.
If nothing matches (therefore nothing can be added into [url removed, login to view]) then script should still create this file but it will be empty.
End of description.