shutil.move when in use?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nicstel
    New Member
    • Jun 2008
    • 20

    shutil.move when in use?

    Hi,

    I have created a script to move some files(pdf) from a directory to another one, but when the file that I want to move is in use it automaticaly copy the file to the new destination. I don't want to copy the file. There is a way to not move and copy the file when is in use?

    here is part of my script.

    Code:
                for DefaultUserName in Final_MoveToRightPerson_Dict:
                    for DrawingName in Final_MoveToRightPerson_Dict[DefaultUserName]:
                        try:
                            if DrawingName in ExistingCopy_List:
                                ShopDrawingExisting_Module(DrawingName)
                            else:
                                
                                Old_PATH = ShopDrawingControl_PATH + "#1 First Copy/" + str(DrawingName)
                                New_PATH = ShopDrawingControl_PATH + "#4 User List/" + str(DefaultUserName) + "/To Check/" + str(DrawingName)
                                try:
                                    shutil.move(Old_PATH, New_PATH)
                                    Continue = True
                                except:pass
                                DrawingInformation_Module(DrawingName, "Move To Check", str(UserList_listbox.Get()))
                        except:pass
    Thank You
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Assuming you are in Windows, there is no way to do that with Python.

    Comment

    • nicstel
      New Member
      • Jun 2008
      • 20

      #3
      Yes I am on windows. To fix my problem, I will try to read if I have any doubled files and if yes I will delete the one that it is not in use.

      Thanks

      Nicolas

      Comment

      Working...