[SOLVED] Using get_current_user()
Published: March 18, 2022 - 2:17 PM
Good morning
I am trying to delete one or more files simultaneously from both the agent profile desktop and the public desktop
For the user: I use os.getlogin() to retrieve the UID
For the public part: path C:\Users\Public\Desktop\
The script I created works correctly locally, but as soon as I build my package and place it in my instance, it no longer works for the user part... The file is only deleted for the "Public" part
I tried with get_current_user(), same result
Problem writing the script? Permissions issue?
Here is the script:
Thank you for your feedback
Sincerely
I am trying to delete one or more files simultaneously from both the agent profile desktop and the public desktop
For the user: I use os.getlogin() to retrieve the UID
For the public part: path C:\Users\Public\Desktop\
The script I created works correctly locally, but as soon as I build my package and place it in my instance, it no longer works for the user part... The file is only deleted for the "Public" part
I tried with get_current_user(), same result
Problem writing the script? Permissions issue?
Here is the script:
Code: Select all
import glob
import os
def install():
user = os.getlogin()
path = "C:\\Users\\" + user + "\\Desktop\\nom_fichier"
for filename1 in glob.glob(r'C:\Users\Public\Desktop\nom_fichier'):
remove_file(filename1)
for filename2 in glob.glob(path):
remove_file(filename2)Thank you for your feedback
Sincerely