--The files uploaded through MS Forms are as follows. --File name_Student's first and last name. Extension. It is in the format of. Please note that some people have surnames. --0FBABF78-CCCB-4958-A17B-61BC43EF27D3_ Tech Taro.jpeg --0FBABF78-CCCB-4958-A17B-61BC43EF27D3_ Tech Taro 1.jpeg --If an image is specified as the format to be submitted in the form, jpg, png, pdf, etc. exist. The file name part depends on the student, so if a file with the same name is submitted, it seems that a serial number will be added like name 1.jpeg. --test_ Tech Hanako.png --I want to convert this to a file with student number_serial number.pdf as shown below.
--The files uploaded through Google Forms are as follows. --File name --Student's first and last name. Extension. It is in the format of. Please note that some students may have surnames. --0FBABF78-CCCB-4958-A17B-61BC43EF27D3 --Technical University Taro.jpeg --0FBABF78-CCCB-4958-A17B-61BC43EF27D3 --Taro Institute of Technology (1) .jpeg --When the same student uploads a file with the same name, (1) etc. will be added after the second one. --test_ Tech Hanako.png --I want to convert this to a file with student number_serial number.pdf as shown below.
--Image files submitted using the file upload function of MS Forms or Google Forms can be individually converted to PDF such as student number_serial number.pdf based on the list information. --PDF conversion other than image files is not possible --Only jpg and png are supported by image files. Not compatible with other formats such as heic --For docx, pptx, html, etc., assume batch conversion with Acrobat after converting the file name with ren_ * file2sid.py --Start Acrobat-> File-> Create-> Create multiple PDF files
--The first and last name was flipped in the original file --Fixed to search by both surname and surname patterns --In some cases, the same student uploaded a file with the same name at the same time. --Since it seems that serial numbers are added to the end of the file name, such as "1.jpg " and "(1) .jpg ", the numbers were deleted using regular expressions when extracting the first and last name from the file name. --Conversion may fail due to Value error, etc.-> Conversion succeeds when the program is re-executed (so far, almost 100% re-execution is successful. The cause is unknown). --If the file name contains machine-dependent characters such as 4 in ○, it will fail if it is cp932 when outputting csv. --Changed the character code for output to utf8
--Create a csv file in the following format --There must be a space between the first and last name --The file must be the character code of cp932 output from Excel as csv. --This program outputs csv for managing the converted file name, but it is output with utf8 (because machine-dependent characters may be used in the file name).
sid | name |
---|---|
B88000 | Institute of Technology Taro |
B87999 | Hanako, Institute of Technology |
--Collect the uploaded image files in a specific folder
python ren_msfile2sid.py cpu2020.csv exama
--The first argument is the csv file name of the list, and the second argument is the directory name where the files such as images are stored.
--Files in the folder containing the image files are moved to the specified folder / output
--The folder name .csv file containing the image file describes which student submitted which file and how it was renamed.python consid2pdf.py cpuexama
--Image data such as student number_serial number.jpg in image folder name / output
is moved to complete, and at the same time a pdf file is created in the pdf folder.
--If there is image data that failed to be converted, it remains in output. In that case, if you re-execute con_sid2pdf.py, it may be converted correctly.python ren_gfile2sid.py se2_2020.csv exama
--The first argument is the csv file name of the student list, and the second argument is the directory name where the files such as images are stored.
--Files in the folder containing the image files are moved to the specified folder / output
--The folder name .csv file containing the image file describes which student submitted which file and how it was renamed.--Same as the one used on the MS Forms side
Recommended Posts