How To Move a File to Another Folder with Python

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Hello, is it possible to add interface to this code? and can it do multiple same file formats at once like move 10 .txt at the same time? Thankss

ByMcCauley
Автор

Hi! Great vid. Do you have anything on how to check if a folder has been updated with a new file, and if so copy it’ and move it somewhere? Would be cool. Thx!

Carlos_Jr_Silva
Автор

Hello does this work on the Mac python as well

BolivianGaming
Автор

I've a question. Im coding a program that moves music files based on certain conditions (such as year, artist, certain tag in comment etc). I save every song of a given path in a list, like this:
tracks = []
for root, dirs, files, in os.walk(path):
for file in files:
if file.endswith(('.mp3', '.wav', '.flac', '.m4a', '.alac')):
tracks.append(file)

The problem is that the first time i run the code it moves the file correctly into a folder, but when rerun it yealds:

'FileNotFoundError: [WinError 2] The system cannot find the file specified: D:\\Music Test Folder\\Wigbert - Rain Shower.mp3' (Its not there because it has been moved to a sub folder in 'Music Test Folder')

It may be because the file in the list doesnt exists in that directory anymore?? Theres a way to simply solve this?

Thanks for your vids and passion, it helps a lot

tonyferru
Автор

I am having issues trying to randomly 25 images from 1 folder into a new created folder. I make slideshows and have 5500 pictures in a folder that I would like to have made into 220 folders of 25 randomly selected pictures from the root folder. I have multiple codes I have tried but always get a error is there a way I could send you the code and see if you can see where my mistake is or explain why I am getting all there errors. The original code I have was from someone that helped me and told me just to change the source folder and destination folder and to change the code from 3 file to 25 but I get a error that code as well but it worked in the video he sent. So I dont know why mine isnt working any help would greatly be appreciated :}

dustonmeyer
Автор

I was looking for a method like os.chdir() everywhere and you where the one that used it! Thanks!

tonyferru
Автор

sir when we use shutil move then this error shows how can close this file before move plz reply
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: '20200814124216.wav'

rinkiyadav
welcome to shbcf.ru