Python Forum
Deleting a PDF Open on the Server
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Deleting a PDF Open on the Server
#1
Hello all,

I am writing a script that updates a directory with a folder structure filled with PDFs. We would like to run this script to update the PDFs each weekend to keep the data up to date. All of files are stored on a server. A large number of computers will have access to view these files and open them (not edit). Everything is working great except for one bug.

If the script runs while someone has the file open it will error out. This is because the script is designed to delete all of the "old" files and then recreate the new ones based on the database it pulls from. When the user has the PDF open windows is blocking me from deleting the file. (using shutil.rmtree)

Is there a way to still delete a file if a user has the file open or is there a way to force the users file to close so this can execute? We would like to avoid leaving the old file in the mix with an error handler as having old versions of the PDF's available would create major problems for the business.

Not sure if this was clear but I would appreciate any help as I am totally stuck on this.

Thanks
Reply
#2
Please Show what you have tried so far.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to take the tar backup files form remote server to local server sivareddy 0 1,933 Jul-14-2021, 01:32 PM
Last Post: sivareddy

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020