Python Forum
Dynamic File Name to a shared folder with open command in python
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dynamic File Name to a shared folder with open command in python
#6
(Jan-06-2022, 05:24 PM)bowlofred Wrote: I don't see why that should problem (on windows). Python is able to access remote shares as UNC paths through normal file operations without an explicit mount. It works fine on my windows box. I would normally do this via pathlib, but glob and the backslash r-strings don't seem to get in the way.

I didn't know, that the Windows API allows accessing via samba protocol shares.
On Linux, this does not work.

Does this work?
from pathlib import Path

server = r"\\10.0.0.10"
share = "USB_Storage"

path = Path(server, share)

print(len(path.glob("*")))
Almost dead, but too lazy to die: https://sourceserver.info
All humans together. We don't need politicians!
Reply


Messages In This Thread
RE: Dynamic File Name to a shared folder with open command in python - by DeaD_EyE - Jan-06-2022, 10:29 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Delete file with read-only permission, but write permission to parent folder cubei 6 22,367 Jun-01-2024, 07:22 AM
Last Post: Eleanorreo
  How to Randomly Print a Quote From a Text File When User Types a Command on Main Menu BillKochman 13 1,423 Apr-24-2024, 05:47 AM
Last Post: Bronjer
Question How to add Python folder in Windows Registry ? Touktouk 1 398 Feb-20-2024, 01:04 PM
Last Post: DeaD_EyE
  Open/save file on Android frohr 0 434 Jan-24-2024, 06:28 PM
Last Post: frohr
  Compare folder A and subfolder B and display files that are in folder A but not in su Melcu54 3 729 Jan-05-2024, 05:16 PM
Last Post: Pedroski55
  file open "file not found error" shanoger 8 1,480 Dec-14-2023, 08:03 AM
Last Post: shanoger
  Reading a file name fron a folder on my desktop Fiona 4 1,093 Aug-23-2023, 11:11 AM
Last Post: Axel_Erfurt
  How can i combine these two functions so i only open the file once? cubangt 4 1,052 Aug-14-2023, 05:04 PM
Last Post: snippsat
  how do I open two instances of visual studio code with the same folder? SuchUmami 3 1,089 Jun-26-2023, 09:40 AM
Last Post: snippsat
  I cannot able open a file in python ? ted 5 3,933 Feb-11-2023, 02:38 AM
Last Post: ted

Forum Jump:

User Panel Messages

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