[vwnc] local-device check

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

[vwnc] local-device check

Dziedzic, Peter

Hello,

i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
Do you know a way how can i do a check like this?
thanks.

best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] local-device check

Holger Guhl
Peter,
the easiest way (for not mapped network drives):
('\\myserver\somedirectory\file1' asFilename volume match: '#:\') ifFalse: ["network drive"]

The reliable way needs a bit more code. Example: 'Z:\file1' (with \\myserver\somedirectory connected as Z:\ ). The testing method should read like this:
PCFilename>>isNetworkName
    | volume typeIndex |
    volume := self volume.
    (volume match: '#:\') ifFalse: [^true "network drive"].
    volume := volume copyWithout: self class separator.    "I believe that GetDriveType() dislikes the trailing backslash"
    typeIndex := Win32FileSystem new GetDriveType: volume.
    ^typeIndex = Win32FileSystem new DRIVE_REMOTE

I have implemented Win32FileSystem as subclass of Win32SystemSupport. The methods above are straight forward:
GetDriveType: driveName
	"Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
	Return code/value	Description
	- DRIVE_UNKNOWN (0): The drive type cannot be determined.
	- DRIVE_NO_ROOT_DIR (1): The root path is invalid; for example, there is no volume is mounted at the path.
	- DRIVE_REMOVABLE (2): The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
	- DRIVE_FIXED (3): The drive has fixed media; for example, a hard drive or flash drive.
	- DRIVE_REMOTE (4): The drive is a remote (network) drive.
	- DRIVE_CDROM (5): The drive is a CD-ROM drive.
	- DRIVE_RAMDISK (6): The drive is a RAM disk.
	(see also http://msdn2.microsoft.com/en-us/library/aa364939(VS.85).aspx)"

	<C: DWORD GetDriveTypeA (LPCTSTR driveName)>
	^self externalAccessFailedWith: _errorCode

DRIVE_REMOTE
	"The drive is a remote (network) drive."

	<C: #define DRIVE_REMOTE 	0x00000004>
Hope that helps.
Cheers
Holger Guhl
-- 
Senior Consultant * Certified Scrum Master * [hidden email]
Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
Georg Heeg eK Dortmund
Handelsregister: Amtsgericht Dortmund  A 12812

Dziedzic, Peter schrieb:

Hello,

i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
Do you know a way how can i do a check like this?
thanks.

best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________ vwnc mailing list [hidden email] http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] Antwort: Re: local-device check - copyTo memory

Dziedzic, Peter

Hello,

thanks for your support. The solution from Holger works very well.

I have another question: How can i make sure when i use the copyTo:-method that i have enough space on the destination-folder.
i know how to get the size of my source-file. but how can i ask how many space i have left on the destination-volume.

thanks again for your help.

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





Holger Guhl <[hidden email]>
Gesendet von: [hidden email]

04.11.2009 16:14

An
"Dziedzic, Peter" <[hidden email]>
Kopie
[hidden email]
Thema
Re: [vwnc] local-device check





Peter,
the easiest way (for not mapped network drives):
('\\myserver\somedirectory\file1' asFilename volume match: '#:\') ifFalse: ["network drive"]

The reliable way needs a bit more code. Example: 'Z:\file1' (with \\myserver\somedirectory connected as Z:\ ). The testing method should read like this:
PCFilename>>isNetworkName
   | volume typeIndex |
   volume := self volume.
   (volume match: '#:\') ifFalse: [^true "network drive"].
   volume := volume copyWithout: self class separator.    "I believe that GetDriveType() dislikes the trailing backslash"
   typeIndex := Win32FileSystem new GetDriveType: volume.
   ^typeIndex = Win32FileSystem new DRIVE_REMOTE

I have implemented Win32FileSystem as subclass of Win32SystemSupport. The methods above are straight forward:

GetDriveType: driveName
                "Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
                Return code/value                 Description
                - DRIVE_UNKNOWN (0): The drive type cannot be determined.
                - DRIVE_NO_ROOT_DIR (1): The root path is invalid; for example, there is no volume is mounted at the path.
                - DRIVE_REMOVABLE (2): The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
                - DRIVE_FIXED (3): The drive has fixed media; for example, a hard drive or flash drive.
                - DRIVE_REMOTE (4): The drive is a remote (network) drive.
                - DRIVE_CDROM (5): The drive is a CD-ROM drive.
                - DRIVE_RAMDISK (6): The drive is a RAM disk.
                (see also
http://msdn2.microsoft.com/en-us/library/aa364939(VS.85).aspx)"

                <C: DWORD GetDriveTypeA (LPCTSTR driveName)>
                ^self externalAccessFailedWith: _errorCode

DRIVE_REMOTE
                "The drive is a remote (network) drive."

                <C: #define DRIVE_REMOTE                  0x00000004>

Hope that helps.
Cheers

Holger Guhl
--
Senior Consultant * Certified Scrum Master *
Holger.Guhl@...
Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
Georg Heeg eK Dortmund
Handelsregister: Amtsgericht Dortmund  A 12812


Dziedzic, Peter schrieb:


Hello,


i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
Do you know a way how can i do a check like this?
thanks.


best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail:
p.dziedzic@...
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.




_______________________________________________
vwnc mailing list
vwnc@...
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
 




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] check free space left on volume e.g. C:

Dziedzic, Peter
In reply to this post by Holger Guhl

Hello,

I have a question concerning working with files: How can i make sure when i use the Filename->copyTo:-method that i have enough space on the destination-folder.
i know how to get the size of my source-file. but how can i ask how many space i have left on the destination-volume.

thanks again for your help.

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





Holger Guhl <[hidden email]>
Gesendet von: [hidden email]

04.11.2009 16:14

An
"Dziedzic, Peter" <[hidden email]>
Kopie
[hidden email]
Thema
Re: [vwnc] local-device check





Peter,
the easiest way (for not mapped network drives):
('\\myserver\somedirectory\file1' asFilename volume match: '#:\') ifFalse: ["network drive"]

The reliable way needs a bit more code. Example: 'Z:\file1' (with \\myserver\somedirectory connected as Z:\ ). The testing method should read like this:
PCFilename>>isNetworkName
   | volume typeIndex |
   volume := self volume.
   (volume match: '#:\') ifFalse: [^true "network drive"].
   volume := volume copyWithout: self class separator.    "I believe that GetDriveType() dislikes the trailing backslash"
   typeIndex := Win32FileSystem new GetDriveType: volume.
   ^typeIndex = Win32FileSystem new DRIVE_REMOTE

I have implemented Win32FileSystem as subclass of Win32SystemSupport. The methods above are straight forward:

GetDriveType: driveName
                "Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
                Return code/value                 Description
                - DRIVE_UNKNOWN (0): The drive type cannot be determined.
                - DRIVE_NO_ROOT_DIR (1): The root path is invalid; for example, there is no volume is mounted at the path.
                - DRIVE_REMOVABLE (2): The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
                - DRIVE_FIXED (3): The drive has fixed media; for example, a hard drive or flash drive.
                - DRIVE_REMOTE (4): The drive is a remote (network) drive.
                - DRIVE_CDROM (5): The drive is a CD-ROM drive.
                - DRIVE_RAMDISK (6): The drive is a RAM disk.
                (see also
http://msdn2.microsoft.com/en-us/library/aa364939(VS.85).aspx)"

                <C: DWORD GetDriveTypeA (LPCTSTR driveName)>
                ^self externalAccessFailedWith: _errorCode

DRIVE_REMOTE
                "The drive is a remote (network) drive."

                <C: #define DRIVE_REMOTE                  0x00000004>

Hope that helps.
Cheers

Holger Guhl
--
Senior Consultant * Certified Scrum Master *
Holger.Guhl@...
Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
Georg Heeg eK Dortmund
Handelsregister: Amtsgericht Dortmund  A 12812


Dziedzic, Peter schrieb:


Hello,


i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
Do you know a way how can i do a check like this?
thanks.


best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany
e-mail:
p.dziedzic@...
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.




_______________________________________________
vwnc mailing list
vwnc@...
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
 




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] check free space left on volume e.g. C:

Andres Valloud-4
Peter,

Maybe there's a better way, but I'd imagine you could implement a method
that opens a new file stream, seeks to the size of the file you're
trying to copy, and if that works then you reset the new file stream and
then copy the contents of the old stream over.  If the seek fails, then
I'd assume the volume does not have enough room to perform the copy
(assuming the file system is not sparse or compressed).  At first sight,
it seems you could add the seek check somewhere along the lines of
privateCopyFrom:to:, before the loop starts copying the file.

HTH,
Andres.


Dziedzic, Peter wrote:

> Hello,
>
> I have a question concerning working with files: How can i make sure when i use the Filename->copyTo:-method that i have enough space on the destination-folder.
> i know how to get the size of my source-file. but how can i ask how many space i have left on the destination-volume.
>
> thanks again for your help.
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
>
> tel: +49 73 64 20-84 48
> fax: +49 73 64 20-48 00
> e-mail: [hidden email]
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
>
> Holger Guhl <[hidden email]>
> Gesendet von: [hidden email]
>
> 04.11.2009 16:14
> An
> "Dziedzic, Peter" <[hidden email]>
> Kopie
> [hidden email]
> Thema
> Re: [vwnc] local-device check
>
>
>
>
>
> Peter,
> the easiest way (for not mapped network drives):
> ('\\myserver\somedirectory\file1' asFilename volume match: '#:\') ifFalse: ["network drive"]
>
> The reliable way needs a bit more code. Example: 'Z:\file1' (with \\myserver\somedirectory connected as Z:\ ). The testing method should read like this:
> PCFilename>>isNetworkName
>    | volume typeIndex |
>    volume := self volume.
>    (volume match: '#:\') ifFalse: [^true "network drive"].
>    volume := volume copyWithout: self class separator.    "I believe that GetDriveType() dislikes the trailing backslash"
>    typeIndex := Win32FileSystem new GetDriveType: volume.
>    ^typeIndex = Win32FileSystem new DRIVE_REMOTE
>
> I have implemented Win32FileSystem as subclass of Win32SystemSupport. The methods above are straight forward:
> GetDriveType: driveName
>                 "Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
>                 Return code/value                 Description
>                 - DRIVE_UNKNOWN (0): The drive type cannot be determined.
>                 - DRIVE_NO_ROOT_DIR (1): The root path is invalid; for example, there is no volume is mounted at the path.
>                 - DRIVE_REMOVABLE (2): The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
>                 - DRIVE_FIXED (3): The drive has fixed media; for example, a hard drive or flash drive.
>                 - DRIVE_REMOTE (4): The drive is a remote (network) drive.
>                 - DRIVE_CDROM (5): The drive is a CD-ROM drive.
>                 - DRIVE_RAMDISK (6): The drive is a RAM disk.
>                 (see also http://msdn2.microsoft.com/en-us/library/aa364939(VS.85).aspx)"
>
>                 <C: DWORD GetDriveTypeA (LPCTSTR driveName)>
>                 ^self externalAccessFailedWith: _errorCode
>
> DRIVE_REMOTE
>                 "The drive is a remote (network) drive."
>
>                 <C: #define DRIVE_REMOTE                  0x00000004>
>
> Hope that helps.
> Cheers
> Holger Guhl
> --
> Senior Consultant * Certified Scrum Master * [hidden email]<mailto:[hidden email]>
> Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
> Georg Heeg eK Dortmund
> Handelsregister: Amtsgericht Dortmund  A 12812
>
> Dziedzic, Peter schrieb:
>
> Hello,
>
> i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
> Do you know a way how can i do a check like this?
> thanks.
>
> best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
> e-mail: [hidden email]<mailto:[hidden email]>
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
> ________________________________
>
> _______________________________________________
> vwnc mailing list
> [hidden email]<mailto:[hidden email]>
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
>  
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] check free space left on volume e.g. C:

Boris Popov, DeepCove Labs (SNN)
In reply to this post by Dziedzic, Peter
Re: [vwnc] check free space left on volume e.g. C:

I'm pretty sure Windows Goodies has a DLLCC call implementation to check free space on volumes.

-Boris (via BlackBerry)

----- Original Message -----
From: [hidden email] <[hidden email]>
To: Visualworks Mailing List <[hidden email]>
Sent: Fri Nov 06 00:21:23 2009
Subject: Re: [vwnc] check free space left on volume e.g. C:

Peter,

Maybe there's a better way, but I'd imagine you could implement a method
that opens a new file stream, seeks to the size of the file you're
trying to copy, and if that works then you reset the new file stream and
then copy the contents of the old stream over.  If the seek fails, then
I'd assume the volume does not have enough room to perform the copy
(assuming the file system is not sparse or compressed).  At first sight,
it seems you could add the seek check somewhere along the lines of
privateCopyFrom:to:, before the loop starts copying the file.

HTH,
Andres.


Dziedzic, Peter wrote:
> Hello,
>
> I have a question concerning working with files: How can i make sure when i use the Filename->copyTo:-method that i have enough space on the destination-folder.
> i know how to get the size of my source-file. but how can i ask how many space i have left on the destination-volume.
>
> thanks again for your help.
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
>
> tel: +49 73 64 20-84 48
> fax: +49 73 64 20-48 00
> e-mail: [hidden email]
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
>
> Holger Guhl <[hidden email]>
> Gesendet von: [hidden email]
>
> 04.11.2009 16:14
> An
> "Dziedzic, Peter" <[hidden email]>
> Kopie
> [hidden email]
> Thema
> Re: [vwnc] local-device check
>
>
>
>
>
> Peter,
> the easiest way (for not mapped network drives):
> ('\\myserver\somedirectory\file1' asFilename volume match: '#:\') ifFalse: ["network drive"]
>
> The reliable way needs a bit more code. Example: 'Z:\file1' (with \\myserver\somedirectory connected as Z:\ ). The testing method should read like this:
> PCFilename>>isNetworkName
>    | volume typeIndex |
>    volume := self volume.
>    (volume match: '#:\') ifFalse: [^true "network drive"].
>    volume := volume copyWithout: self class separator.    "I believe that GetDriveType() dislikes the trailing backslash"
>    typeIndex := Win32FileSystem new GetDriveType: volume.
>    ^typeIndex = Win32FileSystem new DRIVE_REMOTE
>
> I have implemented Win32FileSystem as subclass of Win32SystemSupport. The methods above are straight forward:
> GetDriveType: driveName
>                 "Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
>                 Return code/value                 Description
>                 - DRIVE_UNKNOWN (0): The drive type cannot be determined.
>                 - DRIVE_NO_ROOT_DIR (1): The root path is invalid; for example, there is no volume is mounted at the path.
>                 - DRIVE_REMOVABLE (2): The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
>                 - DRIVE_FIXED (3): The drive has fixed media; for example, a hard drive or flash drive.
>                 - DRIVE_REMOTE (4): The drive is a remote (network) drive.
>                 - DRIVE_CDROM (5): The drive is a CD-ROM drive.
>                 - DRIVE_RAMDISK (6): The drive is a RAM disk.
>                 (see also http://msdn2.microsoft.com/en-us/library/aa364939(VS.85).aspx)"
>
>                 <C: DWORD GetDriveTypeA (LPCTSTR driveName)>
>                 ^self externalAccessFailedWith: _errorCode
>
> DRIVE_REMOTE
>                 "The drive is a remote (network) drive."
>
>                 <C: #define DRIVE_REMOTE                  0x00000004>
>
> Hope that helps.
> Cheers
> Holger Guhl
> --
> Senior Consultant * Certified Scrum Master * [hidden email]<[hidden email]>
> Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
> Georg Heeg eK Dortmund
> Handelsregister: Amtsgericht Dortmund  A 12812
>
> Dziedzic, Peter schrieb:
>
> Hello,
>
> i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
> Do you know a way how can i do a check like this?
> thanks.
>
> best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
> e-mail: [hidden email]<[hidden email]>
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
> ________________________________
>
> _______________________________________________
> vwnc mailing list
> [hidden email]<[hidden email]>
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
>  
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] check free space left on volume e.g. C:

Andres Valloud-6
Re: [vwnc] check free space left on volume e.g. C:
However, between the time you check with DLLCC and the time you finish copying the file, some other process could use some of the volume's space and thus the file copy might fail despite the check.  Assuming seeking first actually allocates the volume's free space for use by the file in question, seeking before copying would be equivalent to an atomic space lock on the volume.  Barring any I/O error, I'd expect the file copy to run to completion if the seek operation is successful.


From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov
Sent: Friday, November 06, 2009 12:26 AM
To: [hidden email]; [hidden email]
Subject: Re: [vwnc] check free space left on volume e.g. C:

I'm pretty sure Windows Goodies has a DLLCC call implementation to check free space on volumes.

-Boris (via BlackBerry)

----- Original Message -----
From: [hidden email] <[hidden email]>
To: Visualworks Mailing List <[hidden email]>
Sent: Fri Nov 06 00:21:23 2009
Subject: Re: [vwnc] check free space left on volume e.g. C:

Peter,

Maybe there's a better way, but I'd imagine you could implement a method
that opens a new file stream, seeks to the size of the file you're
trying to copy, and if that works then you reset the new file stream and
then copy the contents of the old stream over.  If the seek fails, then
I'd assume the volume does not have enough room to perform the copy
(assuming the file system is not sparse or compressed).  At first sight,
it seems you could add the seek check somewhere along the lines of
privateCopyFrom:to:, before the loop starts copying the file.

HTH,
Andres.


Dziedzic, Peter wrote:


> Hello,
>
> I have a question concerning working with files: How can i make sure when i use the Filename->copyTo:-method that i have enough space on the destination-folder.
> i know how to get the size of my source-file. but how can i ask how many space i have left on the destination-volume.
>
> thanks again for your help.
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
>
> tel: +49 73 64 20-84 48
> fax: +49 73 64 20-48 00
> e-mail: [hidden email]
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
>
> Holger Guhl <[hidden email]>
> Gesendet von: [hidden email]
>
> 04.11.2009 16:14
> An
> "Dziedzic, Peter" <[hidden email]>
> Kopie
> [hidden email]
> Thema
> Re: [vwnc] local-device check
>
>
>
>
>
> Peter,
> the easiest way (for not mapped network drives):
> ('\\myserver\somedirectory\file1' asFilename volume match: '#:\') ifFalse: ["network drive"]
>
> The reliable way needs a bit more code. Example: 'Z:\file1' (with \\myserver\somedirectory connected as Z:\ ). The testing method should read like this:
> PCFilename>>isNetworkName
>    | volume typeIndex |
>    volume := self volume.
>    (volume match: '#:\') ifFalse: [^true "network drive"].
>    volume := volume copyWithout: self class separator.    "I believe that GetDriveType() dislikes the trailing backslash"
>    typeIndex := Win32FileSystem new GetDriveType: volume.
>    ^typeIndex = Win32FileSystem new DRIVE_REMOTE
>
> I have implemented Win32FileSystem as subclass of Win32SystemSupport. The methods above are straight forward:
> GetDriveType: driveName
>                 "Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
>                 Return code/value                 Description
>                 - DRIVE_UNKNOWN (0): The drive type cannot be determined.
>                 - DRIVE_NO_ROOT_DIR (1): The root path is invalid; for example, there is no volume is mounted at the path.
>                 - DRIVE_REMOVABLE (2): The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
>                 - DRIVE_FIXED (3): The drive has fixed media; for example, a hard drive or flash drive.
>                 - DRIVE_REMOTE (4): The drive is a remote (network) drive.
>                 - DRIVE_CDROM (5): The drive is a CD-ROM drive.
>                 - DRIVE_RAMDISK (6): The drive is a RAM disk.
>                 (see also http://msdn2.microsoft.com/en-us/library/aa364939(VS.85).aspx)"
>
>                 <C: DWORD GetDriveTypeA (LPCTSTR driveName)>
>                 ^self externalAccessFailedWith: _errorCode
>
> DRIVE_REMOTE
>                 "The drive is a remote (network) drive."
>
>                 <C: #define DRIVE_REMOTE                  0x00000004>
>
> Hope that helps.
> Cheers
> Holger Guhl
> --
> Senior Consultant * Certified Scrum Master * [hidden email]<[hidden email]>
> Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
> Georg Heeg eK Dortmund
> Handelsregister: Amtsgericht Dortmund  A 12812
>
> Dziedzic, Peter schrieb:
>
> Hello,
>
> i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
> Do you know a way how can i do a check like this?
> thanks.
>
> best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
> e-mail: [hidden email]<[hidden email]>
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
> ________________________________
>
> _______________________________________________
> vwnc mailing list
> [hidden email]<[hidden email]>
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
>  
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] check free space left on volume e.g. C:

Nowak, Helge
Re: [vwnc] check free space left on volume e.g. C:
but what if the file system is compressed?


Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Valloud, Andres
Gesendet: Freitag, 6. November 2009 09:35
An: vwnc NC
Betreff: Re: [vwnc] check free space left on volume e.g. C:

However, between the time you check with DLLCC and the time you finish copying the file, some other process could use some of the volume's space and thus the file copy might fail despite the check.  Assuming seeking first actually allocates the volume's free space for use by the file in question, seeking before copying would be equivalent to an atomic space lock on the volume.  Barring any I/O error, I'd expect the file copy to run to completion if the seek operation is successful.


From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov
Sent: Friday, November 06, 2009 12:26 AM
To: [hidden email]; [hidden email]
Subject: Re: [vwnc] check free space left on volume e.g. C:

I'm pretty sure Windows Goodies has a DLLCC call implementation to check free space on volumes.

-Boris (via BlackBerry)

----- Original Message -----
From: [hidden email] <[hidden email]>
To: Visualworks Mailing List <[hidden email]>
Sent: Fri Nov 06 00:21:23 2009
Subject: Re: [vwnc] check free space left on volume e.g. C:

Peter,

Maybe there's a better way, but I'd imagine you could implement a method
that opens a new file stream, seeks to the size of the file you're
trying to copy, and if that works then you reset the new file stream and
then copy the contents of the old stream over.  If the seek fails, then
I'd assume the volume does not have enough room to perform the copy
(assuming the file system is not sparse or compressed).  At first sight,
it seems you could add the seek check somewhere along the lines of
privateCopyFrom:to:, before the loop starts copying the file.

HTH,
Andres.


Dziedzic, Peter wrote:


> Hello,
>
> I have a question concerning working with files: How can i make sure when i use the Filename->copyTo:-method that i have enough space on the destination-folder.
> i know how to get the size of my source-file. but how can i ask how many space i have left on the destination-volume.
>
> thanks again for your help.
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
>
> tel: +49 73 64 20-84 48
> fax: +49 73 64 20-48 00
> e-mail: [hidden email]
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
>
> Holger Guhl <[hidden email]>
> Gesendet von: [hidden email]
>
> 04.11.2009 16:14
> An
> "Dziedzic, Peter" <[hidden email]>
> Kopie
> [hidden email]
> Thema
> Re: [vwnc] local-device check
>
>
>
>
>
> Peter,
> the easiest way (for not mapped network drives):
> ('\\myserver\somedirectory\file1' asFilename volume match: '#:\') ifFalse: ["network drive"]
>
> The reliable way needs a bit more code. Example: 'Z:\file1' (with \\myserver\somedirectory connected as Z:\ ). The testing method should read like this:
> PCFilename>>isNetworkName
>    | volume typeIndex |
>    volume := self volume.
>    (volume match: '#:\') ifFalse: [^true "network drive"].
>    volume := volume copyWithout: self class separator.    "I believe that GetDriveType() dislikes the trailing backslash"
>    typeIndex := Win32FileSystem new GetDriveType: volume.
>    ^typeIndex = Win32FileSystem new DRIVE_REMOTE
>
> I have implemented Win32FileSystem as subclass of Win32SystemSupport. The methods above are straight forward:
> GetDriveType: driveName
>                 "Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
>                 Return code/value                 Description
>                 - DRIVE_UNKNOWN (0): The drive type cannot be determined.
>                 - DRIVE_NO_ROOT_DIR (1): The root path is invalid; for example, there is no volume is mounted at the path.
>                 - DRIVE_REMOVABLE (2): The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
>                 - DRIVE_FIXED (3): The drive has fixed media; for example, a hard drive or flash drive.
>                 - DRIVE_REMOTE (4): The drive is a remote (network) drive.
>                 - DRIVE_CDROM (5): The drive is a CD-ROM drive.
>                 - DRIVE_RAMDISK (6): The drive is a RAM disk.
>                 (see also http://msdn2.microsoft.com/en-us/library/aa364939(VS.85).aspx)"
>
>                 <C: DWORD GetDriveTypeA (LPCTSTR driveName)>
>                 ^self externalAccessFailedWith: _errorCode
>
> DRIVE_REMOTE
>                 "The drive is a remote (network) drive."
>
>                 <C: #define DRIVE_REMOTE                  0x00000004>
>
> Hope that helps.
> Cheers
> Holger Guhl
> --
> Senior Consultant * Certified Scrum Master * [hidden email]<[hidden email]>
> Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
> Georg Heeg eK Dortmund
> Handelsregister: Amtsgericht Dortmund  A 12812
>
> Dziedzic, Peter schrieb:
>
> Hello,
>
> i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
> Do you know a way how can i do a check like this?
> thanks.
>
> best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
> e-mail: [hidden email]<[hidden email]>
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
> ________________________________
>
> _______________________________________________
> vwnc mailing list
> [hidden email]<[hidden email]>
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
>  
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] check free space left on volume e.g. C:

Andres Valloud-6
Re: [vwnc] check free space left on volume e.g. C:
I do not know what happens with compressed file systems.  I do not know what happens for sparse file systems that pretend to allocate real space but keep track of file blocks that are full of zeros.  I do not know what a using DLLCC to call something that reports free space in a compressed volume would mean, either.


From: Nowak, Helge
Sent: Friday, November 06, 2009 12:52 AM
To: Valloud, Andres; vwnc NC
Subject: AW: [vwnc] check free space left on volume e.g. C:

but what if the file system is compressed?


Von: [hidden email] [mailto:[hidden email]] Im Auftrag von Valloud, Andres
Gesendet: Freitag, 6. November 2009 09:35
An: vwnc NC
Betreff: Re: [vwnc] check free space left on volume e.g. C:

However, between the time you check with DLLCC and the time you finish copying the file, some other process could use some of the volume's space and thus the file copy might fail despite the check.  Assuming seeking first actually allocates the volume's free space for use by the file in question, seeking before copying would be equivalent to an atomic space lock on the volume.  Barring any I/O error, I'd expect the file copy to run to completion if the seek operation is successful.


From: [hidden email] [mailto:[hidden email]] On Behalf Of Boris Popov
Sent: Friday, November 06, 2009 12:26 AM
To: [hidden email]; [hidden email]
Subject: Re: [vwnc] check free space left on volume e.g. C:

I'm pretty sure Windows Goodies has a DLLCC call implementation to check free space on volumes.

-Boris (via BlackBerry)

----- Original Message -----
From: [hidden email] <[hidden email]>
To: Visualworks Mailing List <[hidden email]>
Sent: Fri Nov 06 00:21:23 2009
Subject: Re: [vwnc] check free space left on volume e.g. C:

Peter,

Maybe there's a better way, but I'd imagine you could implement a method
that opens a new file stream, seeks to the size of the file you're
trying to copy, and if that works then you reset the new file stream and
then copy the contents of the old stream over.  If the seek fails, then
I'd assume the volume does not have enough room to perform the copy
(assuming the file system is not sparse or compressed).  At first sight,
it seems you could add the seek check somewhere along the lines of
privateCopyFrom:to:, before the loop starts copying the file.

HTH,
Andres.


Dziedzic, Peter wrote:


> Hello,
>
> I have a question concerning working with files: How can i make sure when i use the Filename->copyTo:-method that i have enough space on the destination-folder.
> i know how to get the size of my source-file. but how can i ask how many space i have left on the destination-volume.
>
> thanks again for your help.
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
>
> tel: +49 73 64 20-84 48
> fax: +49 73 64 20-48 00
> e-mail: [hidden email]
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
>
> Holger Guhl <[hidden email]>
> Gesendet von: [hidden email]
>
> 04.11.2009 16:14
> An
> "Dziedzic, Peter" <[hidden email]>
> Kopie
> [hidden email]
> Thema
> Re: [vwnc] local-device check
>
>
>
>
>
> Peter,
> the easiest way (for not mapped network drives):
> ('\\myserver\somedirectory\file1' asFilename volume match: '#:\') ifFalse: ["network drive"]
>
> The reliable way needs a bit more code. Example: 'Z:\file1' (with \\myserver\somedirectory connected as Z:\ ). The testing method should read like this:
> PCFilename>>isNetworkName
>    | volume typeIndex |
>    volume := self volume.
>    (volume match: '#:\') ifFalse: [^true "network drive"].
>    volume := volume copyWithout: self class separator.    "I believe that GetDriveType() dislikes the trailing backslash"
>    typeIndex := Win32FileSystem new GetDriveType: volume.
>    ^typeIndex = Win32FileSystem new DRIVE_REMOTE
>
> I have implemented Win32FileSystem as subclass of Win32SystemSupport. The methods above are straight forward:
> GetDriveType: driveName
>                 "Determines whether a disk drive is a removable, fixed, CD-ROM, RAM disk, or network drive.
>                 Return code/value                 Description
>                 - DRIVE_UNKNOWN (0): The drive type cannot be determined.
>                 - DRIVE_NO_ROOT_DIR (1): The root path is invalid; for example, there is no volume is mounted at the path.
>                 - DRIVE_REMOVABLE (2): The drive has removable media; for example, a floppy drive, thumb drive, or flash card reader.
>                 - DRIVE_FIXED (3): The drive has fixed media; for example, a hard drive or flash drive.
>                 - DRIVE_REMOTE (4): The drive is a remote (network) drive.
>                 - DRIVE_CDROM (5): The drive is a CD-ROM drive.
>                 - DRIVE_RAMDISK (6): The drive is a RAM disk.
>                 (see also http://msdn2.microsoft.com/en-us/library/aa364939(VS.85).aspx)"
>
>                 <C: DWORD GetDriveTypeA (LPCTSTR driveName)>
>                 ^self externalAccessFailedWith: _errorCode
>
> DRIVE_REMOTE
>                 "The drive is a remote (network) drive."
>
>                 <C: #define DRIVE_REMOTE                  0x00000004>
>
> Hope that helps.
> Cheers
> Holger Guhl
> --
> Senior Consultant * Certified Scrum Master * [hidden email]<[hidden email]>
> Tel: +49 231 9 75 99 21 * Fax: +49 231 9 75 99 20
> Georg Heeg eK Dortmund
> Handelsregister: Amtsgericht Dortmund  A 12812
>
> Dziedzic, Peter schrieb:
>
> Hello,
>
> i have a File ( NTFSFilename-Object) and i want to check if the file is on a local-harddrive or on a network-drive.
> Do you know a way how can i do a check like this?
> thanks.
>
> best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
> e-mail: [hidden email]<[hidden email]>
> http://www.zeiss.de/imt
>
> Carl Zeiss Industrielle Messtechnik GmbH
> Carl-Zeiss-Straße 22, 73447 Oberkochen
> Aufsichtsratsvorsitzender: Dr. Dieter Kurz
> Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
> Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
> Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
> ________________________________
>
> _______________________________________________
> vwnc mailing list
> [hidden email]<[hidden email]>
> http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
>
>
>
>
> ----------------------------------------
> This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.
>
>
>  
_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: [vwnc] check free space left on volume e.g. C:

Holger Guhl
In reply to this post by Dziedzic, Peter
Peter,
others gave you valuable answers and pointed out to the rich set of
problems your request might arise.
Since your last request (and the acceptable solution) was Window
specific, I'ld like to hint on a simple solution that works. Maybe all
the possible problems are not an issue in your desired scenario.
Please, open the Parcel Manager, select section "OS-Windows" and load
parcel "Windows Goodies [7.2]". Thereafter you can run
    OSSystemSupport concreteClass spacesForVolume: 'G:\'
('G:\' is the volume name that my Windows assigned after plugging in my
USB stick)
This returns the basic size information for the device. The result is an
Array. The first and last elements are the most interesting for you.
Details on the specific meaning of the result can be read from
Win95SystemSupport class>>spacesForVolume:

Cheers
- Holger

Dziedzic, Peter schrieb:

>
> Hello,
>
> I have a question concerning working with files: How can i make sure
> when i use the Filename->copyTo:-method that i have enough space on
> the destination-folder.
> i know how to get the size of my source-file. but how can i ask how
> many space i have left on the destination-volume.
>
> thanks again for your help.
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
>
> tel: +49 73 64 20-84 48
> fax: +49 73 64 20-48 00
> e-mail: [hidden email]
> http://www.zeiss.de/imt

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

[vwnc] Antwort: Re: check free space left on volume e.g. C:

Dziedzic, Peter

Hello all,

thanks for your answers. There are many good answers and ideas.

Holger Guhl is right. For me is a simple solution enough. I just want to copy a file from a volume to another and therefore i want to have some simple checking if there is enough size on the other volume.
So the solution from Holger is enough for me.

Thanks all.

Mit freundlichen Grüßen - best regards,

Peter Dziedzic

--------------------------------------

Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
Softwareentwicklung/Software Development

P e t e r  D z i e d z i c

73446 Oberkochen, Germany

tel: +49 73 64 20-84 48
fax: +49 73 64 20-48 00
e-mail: [hidden email]
http://www.zeiss.de/imt

Carl Zeiss Industrielle Messtechnik GmbH
Carl-Zeiss-Straße 22, 73447 Oberkochen
Aufsichtsratsvorsitzender: Dr. Dieter Kurz
Geschäftsführer: Dr. Rainer Ohnheiser, Felix Hoben, Hanspeter Mürle
Sitz der Gesellschaft: 73446 Oberkochen, Deutschland
Amtsgericht Ulm, HRB 501561, USt-IdNr.: DE 811 515 346





Holger Guhl <[hidden email]>
Gesendet von: [hidden email]

06.11.2009 12:11

An
"Dziedzic, Peter" <[hidden email]>
Kopie
[hidden email]
Thema
Re: [vwnc] check free space left on volume e.g. C:





Peter,
others gave you valuable answers and pointed out to the rich set of
problems your request might arise.
Since your last request (and the acceptable solution) was Window
specific, I'ld like to hint on a simple solution that works. Maybe all
the possible problems are not an issue in your desired scenario.
Please, open the Parcel Manager, select section "OS-Windows" and load
parcel "Windows Goodies [7.2]". Thereafter you can run
   OSSystemSupport concreteClass spacesForVolume: 'G:\'
('G:\' is the volume name that my Windows assigned after plugging in my
USB stick)
This returns the basic size information for the device. The result is an
Array. The first and last elements are the most interesting for you.
Details on the specific meaning of the result can be read from
Win95SystemSupport class>>spacesForVolume:

Cheers
- Holger

Dziedzic, Peter schrieb:

>
> Hello,
>
> I have a question concerning working with files: How can i make sure
> when i use the Filename->copyTo:-method that i have enough space on
> the destination-folder.
> i know how to get the size of my source-file. but how can i ask how
> many space i have left on the destination-volume.
>
> thanks again for your help.
>
> Mit freundlichen Grüßen - best regards,
>
> Peter Dziedzic
>
> --------------------------------------
>
> Carl Zeiss Industrielle Meßtechnik GmbH/ Industrial Metrology
> Softwareentwicklung/Software Development
>
> P e t e r  D z i e d z i c
>
> 73446 Oberkochen, Germany
>
> tel: +49 73 64 20-84 48
> fax: +49 73 64 20-48 00
> e-mail: [hidden email]
> http://www.zeiss.de/imt




----------------------------------------
This message is intended for a particular addressee only and may contain business or company secrets. If you have received this email in error, please contact the sender and delete the message immediately. Any use of this email, including saving, publishing, copying, replication or forwarding of the message or the contents is not permitted.


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc