I have a large no. of zip file whose name is only numerical. Now each zip file contains a folder having the same name as the zip file( ie if the name of the zip file is say 1234.zip then the name of the folder will also be 1234). Also this folder contains a text file say atextfile.txt, which contains integer specifying the year of the zip say 2016.  

Now I want to move each zip file to its respective folder ie year wise. Meaning what i want to do is extract the value of year ie 2016 and make a folder named 2016, move the zip file to this folder and do the same for the next zip file.  

I was successful in retrieving the year and storing it in a variable named year.  

The code I have written so far:

```
    import glob
    import os
    import zipfile
    import shutil
    for zip_name in glob.glob('[0-9]*.zip'):
        z=zipfile.ZipFile(zip_name)
        # To remove '.zip' from the name of zip_name
        subdir = zip_name[:-4]
        with z.open('{}/atextfile.txt'.format(subdir)) as f:
            for line in f:
                for word in line:
                    year = word
                    # the file atextfile.txt has many lines containing many                        integer of which the first line represents the year.
                    break
                else:
                    continue
                break
        z.close()
        if not os.path.exists(year):
            os.makedirs(year)
        shutil.move(zip_name, year)

```

This is gives the error:  
 WindowsError: [Error 32] The process cannot access the file because it is being used by another process.  
 I googled it and I came to know that the reason behind this is because my zip file is already opened. But I am unable to solve this problem, so please help.  

UPDATE: The problem is solved I stored the zip\_name and year in a text file and then in another program read the text file and moved the corresponding zip file to its year folder. Thanks for responses.