Linux servers, network and file names

I

Infinity77

Hi All,

I apologize in advance if this sounds like a stupid question but I am
really no expert at all in network things, and I may be looking in the
wrong direction altogether.

At work we have a bunch of Linux servers, and we can connect to them
with our Windows PCs over a network. Now, let's assume we only have
one Linux server, let's call it SERVER. Everyone of us, on our Windows
PC, can map this server as a network drive choosing whatever Windows
"drive letter" he wants. For example, I could map SERVER to be "Y:/",
my colleague might call it "Z:/" and so on.

The problem arises in one of my little applications, which allows the
user to choose a file living in SERVER and do some calculations with
it; then, this file name gets saved in a common database (common in
the sense that it is shared between Windows users, ourselves). Now, I
choose this file myself, the FileDialog (a window representing a file
selector dialog) will return something like this (let's ignore the
back/forward slashes, this is not an issue):

Y:/Folder/FileName.txt

If my colleague does it, he will get:

Z:/Folder/FileName.txt

Even if I am able to work out the server name using the Windows drive
letter (and I was able to do it, now I don't remember anymore how to
do it), what I get is:

For me: //SERVER/gavana/Folder/FileName.txt
Colleague: //SERVER/Colleague/Folder/FileName.txt

So, no matter what I do, the file name stored in the database is user-
dependent and not universal and common to all of us.

Am I missing something fundamental? I appreciate any suggestion, even
a Windows-only solution (i.e., based on PyWin32) would be perfect.

Thank you in advance for your help.

Andrea.
 
T

Tim Golden

choose this file myself, the FileDialog (a window representing a file
selector dialog) will return something like this (let's ignore the
back/forward slashes, this is not an issue):

Y:/Folder/FileName.txt

If my colleague does it, he will get:

Z:/Folder/FileName.txt

Even if I am able to work out the server name using the Windows drive
letter (and I was able to do it, now I don't remember anymore how to
do it), what I get is:

For me: //SERVER/gavana/Folder/FileName.txt
Colleague: //SERVER/Colleague/Folder/FileName.txt


Why do you and your colleagues have different share names?

Can you just use a UNC like the above and end up with the same path?

TJG
 
I

Infinity77

Hi Tim,

choose this file myself, the FileDialog (a window representing a file
selector dialog) will return something like this (let's ignore the
back/forward slashes, this is not an issue):
Y:/Folder/FileName.txt

If my colleague does it, he will get:
Z:/Folder/FileName.txt

Even if I am able to work out the server name using the Windows drive
letter (and I was able to do it, now I don't remember anymore how to
do it), what I get is:

For me:  //SERVER/gavana/Folder/FileName.txt
Colleague: //SERVER/Colleague/Folder/FileName.txt

Why do you and your colleagues have different share names?


I have no idea, I will ask our IT, they set it up :)
Can you just use a UNC like the above and end up with the same path?

By the few tests I run up to now, seems like I can... it seems odd
however for a file name stored somewhere (I mean, the string
representing the file name) to have my name in it. Feels fragile and
incorrect. But whatever ;-)

Thank you Tim for your help.

Andrea.
 
R

Rebelo

Infinity77 said:
Hi All,

I apologize in advance if this sounds like a stupid question but I am
really no expert at all in network things, and I may be looking in the
wrong direction altogether.

At work we have a bunch of Linux servers, and we can connect to them
with our Windows PCs over a network. Now, let's assume we only have
one Linux server, let's call it SERVER. Everyone of us, on our Windows
PC, can map this server as a network drive choosing whatever Windows
"drive letter" he wants. For example, I could map SERVER to be "Y:/",
my colleague might call it "Z:/" and so on.

The problem arises in one of my little applications, which allows the
user to choose a file living in SERVER and do some calculations with
it; then, this file name gets saved in a common database (common in
the sense that it is shared between Windows users, ourselves). Now, I
choose this file myself, the FileDialog (a window representing a file
selector dialog) will return something like this (let's ignore the
back/forward slashes, this is not an issue):

Y:/Folder/FileName.txt

If my colleague does it, he will get:

Z:/Folder/FileName.txt

Even if I am able to work out the server name using the Windows drive
letter (and I was able to do it, now I don't remember anymore how to
do it), what I get is:

For me: //SERVER/gavana/Folder/FileName.txt
Colleague: //SERVER/Colleague/Folder/FileName.txt

So, no matter what I do, the file name stored in the database is user-
dependent and not universal and common to all of us.

Am I missing something fundamental? I appreciate any suggestion, even
a Windows-only solution (i.e., based on PyWin32) would be perfect.

Thank you in advance for your help.

Andrea.


why don't you store servers path to file in a database?
example:
//SERVER/Public/file.txt

this way you can use python to list files in share without the need for
mapping drives, if permissions are set correctly.
 
M

Martin P. Hellwig

On 04/22/10 15:13, Infinity77 wrote:
For me: //SERVER/gavana/Folder/FileName.txt
Colleague: //SERVER/Colleague/Folder/FileName.txt

So, no matter what I do, the file name stored in the database is user-
dependent and not universal and common to all of us.
If that user dependent part happens to be equal to the login name, then
what you could do is replace is with the username variable (I believe
%USERNAME% on windows) instead.
 
I

Infinity77

Hi Martin & All,

On 04/22/10 15:13, Infinity77 wrote:



If that user dependent part happens to be equal to the login name, then
what you could do is replace is with the username variable (I believe
%USERNAME% on windows) instead.

The funny thing is that the user dependent part *is* the login name,
but not the Windows one, it is the *Linux SERVER* one, and no mapping
has been done between Windows logins and Linux usernames. IT...

Anyway, it seems like Tim's suggestion is working (for the moment), so
I'll stick with it as this network/filenames issue has already taken
me a ridiculous amount of time to fix :)

Thank you guys for your help!

Andrea.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top