-1

I am having a problem moving a folder full of files to a different drive and was hoping there was some way to automate this using python. The file transfer keeps crashing windows explorer and then I have to restart my pc. I've done some research and couldn't find anything helpful. I want to automate it so that it only moves 1 file at a time and waits for it to finish the transfer before it starts the next.

Sinful712
  • 7
  • 4

1 Answers1

-3

have a for-loop and for each "i" do a function to assign the file to drive. also if you wanna automate you have to have a way to identify which files you wanna put because else the computer wont know how to assign it. You need a search algorithm as a function. so its mainly part of the search algorithm that you need to care about. how you want files to organise. like files that start with "a" to be on your desktop folder or something...

for i in range(number of files):
    search_algorithm();
Tommy Cho
  • 1
  • 1
  • I recommented sorry for the bad post – Tommy Cho Aug 02 '22 at 01:42
  • also make sure you have all the files you wanna automate on the same directory and the same folder. – Tommy Cho Aug 02 '22 at 01:43
  • If you're going to answer, at least *try* to give the OP some usable code. This answer is just hand-waving. Also, this question has been asked a million times - see the duplicate it's tagged with. – MattDMo Aug 02 '22 at 01:46
  • but it's not just moving the file, he needs to automate it right? But I don't know how or what order he wants to put the files in. For example all the files' names that start with "a" could go to the home folder. So I can't write usable code. Sorry if my comment angered you. – Tommy Cho Aug 02 '22 at 01:52
  • It says right there at the very beginning of the question: *"I am having a problem moving a folder full of files to a different drive"*. The simplest reading of that suggests that they want to move all the files in the directory to a different directory on another drive. `os.listdir` and `shutil.move` are all you need. – MattDMo Aug 02 '22 at 02:02