How can I move / copy a file that contains ("YYMMDD file") to its respective folder that contains the name of the Month (January, February, etc.) in Python?
Currently the date code is concatenated with a bday so that it only takes business days:
day = days[0].dt.strftime("%Y%m%d").astype(int)
Then I create an arrangement with the name of the files
files = ['archivo1','archivo2','archivo3',etc...]
I make a for where I send call the calendar with the month and create directories in case of not having them
for month in calendar.month_name[1:]:
if not os.path.exists(directory+"\"+month):
os.makedirs(directory+"\"+month)
Then I take the days and in a for I connect it with the names
for x in day :
for y in files :
value = str(y)+str(x)
shutil.copy(directory+"\"+str(y)+".xlsx",directory+"\"+month+"\"+str(value)+".xlsx") //El tema aqui es que cuando lo corro se copia en c/u de los directorios sin tomar en cuenta el mes...
The issue I have is that before the shutil I would like to know if I can send them to the folder with their corresponding month ...
The result that I get with the concatenation is this:
archivo120181212.xlsx
And there it would be to take the month only, I do not know if I have to do it backwards or how ...?