Hi I need to delete the temp files using one main account for different users.
I can delete the temp files using the solution provided
But I need to delete it for different users.
How to do it using the names of different users from Config file?
Hi I need to delete the temp files using one main account for different users.
I can delete the temp files using the solution provided
But I need to delete it for different users.
How to do it using the names of different users from Config file?
First you need to have that admin access on those folders
if you have as the location is common have a place holder to change the usernme and access different folder
eg:c:\Usrrs\USERNAME\andsoon - in this USERNAME can be replaced with each user details you have
cheers
Hi @Anil_G
We have the admin access for the same.
Cheers
Hi @Anil_G

I have used the above code.
Can you just suggest the way to make the changes.
Thanks in advance!!
You can use for loop with users list you have
then inside that use tempfolderpath.Replace(Environment.Username,currentItem)
check how you are getting the username and accordingly change code if needed
cheers
Another option, so that you don’t have to keep track of any potential user on that system is this:
Assign s_AllUserFolders = directory.getfolders("C:\Users\")
For Each s_UserFolder in s_AllUserFolders
assign s_Tempfolder = path.combine(s_UserFolder, "RestOfThePAth\andsoon")
If directory.exists(s_Tempfolder) then
For each s_File in Directory.GetFiles(s_Tempfolder)
Delete s_File
End For
End If
End For
Translate this into activities where needed.
This whould dynamically clean all of the tempfolders for any user.
You may need to wrap the delete s_File itself in a try/catch, in case any file is still used/locked/etc.
Hi @Anil_G
I am trying to replace the username but it is not replacing it.

I have uploaded the screenshot of the same.
Thanks in advance!!
Does your tempfolderpath contain the username that is printed? And is it of exact same casingn?
If not then change the casing or do split and get the username as needed
Cheers
Hi @Anil_G
Yes it contains the username and while replacing it it is not changing the value.
Thanks in advance!!
Then username is not matching i guess check that may be casing issue use .tolower on both sides
Cheers