Accessing network filesystem

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
mobi-doc
Posts: 59
Joined: Wed Nov 21, 2007 11:29 am
Location: Greece

Accessing network filesystem

Post by mobi-doc »

In Windows I can access home network filesystem like:

dir \\COMPUTERNAME\sharedfoldername\*.*

This notation doesn't seem to work with OOBASIC.
Is there any way with BASIC or using UNO services to access files and directories on another home network computer?

Thanks in advance.
TerryE
Volunteer
Posts: 1402
Joined: Sat Oct 06, 2007 10:13 pm
Location: UK

Re: Accessing network filesystem

Post by TerryE »

try

Code: Select all

Sub Main
print ConvertToURL("\\COMPUTERNAME\sharedfoldername\*.*")
print ConvertToURL("D:\*.*")
End Sub
The reason for the 3 /s in file: an http: URLs is that they go //hostname/restOfTheFileDescriptor. /// = localhost
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
mobi-doc
Posts: 59
Joined: Wed Nov 21, 2007 11:29 am
Location: Greece

Re: Accessing network filesystem

Post by mobi-doc »

Yes but a

Code: Select all

print dir("\\COMPUTERNAME\sharefoldername\")
returns always an empty string. Conversions working but the file accessing part is problematic.
TerryE
Volunteer
Posts: 1402
Joined: Sat Oct 06, 2007 10:13 pm
Location: UK

Re: Accessing network filesystem

Post by TerryE »

Yup, there does seem to be a issue here with UNC enumeration in the dir function. I haven't tried other operations such as open. A work around is to use explorer to map the network drive, or do a net use X: \\COMPUTERNAME\sharedfoldername at the command prompt. You will find that dir "X:\*.*" works fine.
Ubuntu 11.04-x64 + LibreOffice 3 and MS free except the boss's Notebook which runs XP + OOo 3.3.
mobi-doc
Posts: 59
Joined: Wed Nov 21, 2007 11:29 am
Location: Greece

Re: Accessing network filesystem

Post by mobi-doc »

In my case that's not enough. I'm trying to write a stand-alone File and Directory Synchronization application using Base, that would work in local files as well as local networks with Windows or Linux machines. UNO is perfect for hiding OS specific differences, and I would like a UNO solution to this problem.

Thanks anyway.
Post Reply