# Access to a shared folder to rename a file that ask for a login

**URL:** <https://forum.inductiveautomation.com/t/access-to-a-shared-folder-to-rename-a-file-that-ask-for-a-login/59692>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [May 17, 2022, 8:17pm UTC](https://forum.inductiveautomation.com/t/access-to-a-shared-folder-to-rename-a-file-that-ask-for-a-login/59692 "2022-05-17T20:17:54Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![rigoberto.reyes](https://avatars.discourse-cdn.com/v4/letter/r/65b543/32.png) [@rigoberto.reyes](https://forum.inductiveautomation.com/u/rigoberto.reyes)\
**Post date:** [May 17, 2022, 8:17pm UTC](https://forum.inductiveautomation.com/t/access-to-a-shared-folder-to-rename-a-file-that-ask-for-a-login/59692/1 "2022-05-17T20:17:54Z")

</div>

Hi there.

Recently, I already crated a script to read and rename a remote file (IP address 10.1.2.26), it is possible to read it, but is not possible to rename it , because the remote folder is protected and login is needed.

This is the code to rename the remote file:

FileName= CurrentDate.strftime("%Y%m%d%H%M%S") + “.txt”  
file\_oldname = os.path.join("\\HostName\Folder\\", “Results.txt”)   
file\_newname\_newfile = os.path.join("\\HostName\Folder\", FileName)  
os.rename(file\_oldname, file\_newname\_newfile)

How to build the script to log into the remote folder with the user and password?

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [May 19, 2022, 5:32pm UTC](https://forum.inductiveautomation.com/t/access-to-a-shared-folder-to-rename-a-file-that-ask-for-a-login/59692/2 "2022-05-19T17:32:32Z")

</div>

You probably would want to mount the folder as a network drive on your gateway computer.

[Mapping a Network Drive - Ignition User Manual 7.9 - Ignition Documentation (inductiveautomation.com)](https://docs.inductiveautomation.com/display/DOC79/Mapping+a+Network+Drive)

---

<div class="post-metadata">

**Author:** ![josborn](https://avatars.discourse-cdn.com/v4/letter/j/4bbf92/32.png) [@josborn](https://forum.inductiveautomation.com/u/josborn)\
**Post date:** [May 19, 2022, 5:33pm UTC](https://forum.inductiveautomation.com/t/access-to-a-shared-folder-to-rename-a-file-that-ask-for-a-login/59692/3 "2022-05-19T17:33:34Z")

</div>

That or grant the user that the ignition service is ran under access. I usually go this route as mapped drives have been known to dissapear… windows.
