By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,386 Members | 1,165 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,386 IT Pros & Developers. It's quick & easy.

shutil.move when in use?

P: 20
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.

Expand|Select|Wrap|Line Numbers
  1.             for DefaultUserName in Final_MoveToRightPerson_Dict:
  2.                 for DrawingName in Final_MoveToRightPerson_Dict[DefaultUserName]:
  3.                     try:
  4.                         if DrawingName in ExistingCopy_List:
  5.                             ShopDrawingExisting_Module(DrawingName)
  6.                         else:
  7.  
  8.                             Old_PATH = ShopDrawingControl_PATH + "#1 First Copy/" + str(DrawingName)
  9.                             New_PATH = ShopDrawingControl_PATH + "#4 User List/" + str(DefaultUserName) + "/To Check/" + str(DrawingName)
  10.                             try:
  11.                                 shutil.move(Old_PATH, New_PATH)
  12.                                 Continue = True
  13.                             except:pass
  14.                             DrawingInformation_Module(DrawingName, "Move To Check", str(UserList_listbox.Get()))
  15.                     except:pass
  16.  
Thank You
Jan 23 '13 #1

✓ answered by bvdet

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

Share this Question
Share on Google+
2 Replies

bvdet
Expert Mod 2.5K+
P: 2,851
Assuming you are in Windows, there is no way to do that with Python.
Jan 28 '13 #2

P: 20
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
Jan 28 '13 #3

Post your reply

Sign in to post your reply or Sign up for a free account.