The issue I was having before was that I had some of my images stored on my computer, and when I tried to upload them, I got a message from Google Photos saying that some of the photos weren't uploaded, I then copied and pasted the names of the images that Google Photos displayed into a text file(photo list.txt). Now I was shocked, wondering how I was going to be able to upload only those photographs that weren't already uploaded from the folder that had roughly 5,000 images.
I began to consider it, and then an idea struck me, why can't I develop a code to perform this process for me? After all, going through thousands of photographs one by one would be boring.
and spend a few hours working on that code before doing some research and discovering how to copy files from source to destination! I have numerous files to copy, though, so I've ended myself back where I started.
I did all of this in a college classroom during lecture. I didn't care about the lecture that day because my thoughts were constantly on the issue, so I just kept changing the code until I found the first raw version that worked for me.
Solution with I Came up
import shutil photo_fl = open("photo list.txt", "r") p = photo_fl.readlines() error_lst = [] for i in p: i = error_lst.append(i) for i in error_lst: i = i.strip("\n") source_loc = "C:\\Photos\\Canada Photos" + "\\" + i
destination = "C:\\Photos Error\\Not Uploaded pics" shutil.copy(source_loc, destination)
You can't become a good programmer by merely answering the predefined logical online question! go outside and consider how you might be able to use your skills to solve the problem. I am aware that this may not be the best Python code for solving this kinda Issue, but for now, that matter is irrelevant to me.
Comments