Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Moving a file in python using shutil

Hi, I am currently learning python 3 and needed to learn how to move a file for a script I am currently making.

I have commented so you know what is going on. I am using the shutil module and getting user input.

This is written for py3

Quote:#Importing the shutil module
import shutil

#Asking user input for the source file
source = input("Please enter your source file > ")

#Asking user input for destination
destination = input("Now please enter your destination file > ")

#Moving the source to destination =
shutil.move(source, destination)

print (" ")
print ("Your file was moved to ", destination)

the script is working good buddy ,,, and there is no problem in it ... what do u need ???
(Jan 24, 2012 05:03 PM)Hydra_ Wrote:  the script is working good buddy ,,, and there is no problem in it ... what do u need ???

Don't need anything was just posting it up to help other users
(Jan 24, 2012 05:07 PM)Needlz Wrote:  Don't need anything was just posting it up to help other users

ahaaa ... sorry 😁

but, don't u see it's kinda little thread ... i mean u can put many other things in addition to this ... and you are a LEET so u can Edit ur thread any time 🙂 ... just my opinion ✌
This has already been posted. But a nice contribution non the less.

-Rhynorater.
-Rhynorater. (Previous Python section moderator)
[Image: TQjiRHy.png]
Pretty neat script.Kind of less interactive though for the user has to input the directory.
It may have been better if you had stored it as a variable or passed it as a parameter of a function.(I'm gonna try a bit more)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Python] by Bass_ReevesAug 20, 2023 01:44 AM 9 632 Aug 20, 2023 01:44 AM
Last Post: Lucky4L
[Python] by ZamperJan 28, 2020 09:30 PM 3 179 Jan 28, 2020 09:30 PM
Last Post: Shisho
[.NET] by thatitguyAug 18, 2018 03:03 AM 1 113 Aug 18, 2018 03:03 AM
Last Post: Lagging_BarISH