I have GUI software that allows moving files by extensions and I am using Robocopy and Configparser. The extensions chosen by the user are stored in:
Files_1_Extensions_Read = parser.get("Extensions", "Search_1")
If I manually add the extensions in the code it works and I can add several in a row (example: "*mp4", "*avi" etc) my problem occurs when using the GUI I enter a list of extensions like the one mentioned above. Robocopy does not detect the extensions correctly and does not copy anything. This is the call I am using:
call(["robocopy",src_1,dst_1,"/S",Files_1_Extensions_Read])
The funny thing is that in the sublimetext console when I place the extensions through the GUI it goes like this:
And when I put them directly in the code I get something like this:
It's as if robocopy couldn't read the text correctly and took it as if there was nothing.
I've already tried using literal_eval() just to drop and it still doesn't work.
My intention is not to advertise my software, so I don't know if I can put my repository on GitHub with all the code of my program (+3,000 lines) in case someone wants to help me with this problem and needs to see the source code. If any moderator allows me, I will put it.
You must separate each extension as a list item, for example if I want to copy files
.bmp
and.pptx
from SOURCE to DESTINATION :Assuming you
configparser
get a list of extensions as a string (that or numbers haha) with the extensions separated by a space (in case of a more complex format you can always rely on bigMama i.e. RegEx...) like below:In your code adding
Files_1_Extensions_Read
to the end is the same as adding a string, call won't know what to do with it (rather, robocopy won't know what to do, you could add a LOG:logfile to the end to see what robocopy does in the background )