• Welcome to Valhalla Legends Archive.
 

Recreating a file

Started by Yegg, November 11, 2005, 06:25 PM

Previous topic - Next topic

Kp

Quote from: Yegg on November 13, 2005, 08:49 AMWhat about my computer that has Linux on it, what if I want to send a file from that computer to one of my computers with Windows on it? I'm not going to have much luck am I. This is one of the main reasons I am even creating this program.

Mount the drive as Z: using Samba on the Linux system to export it, then use a copy command? :P  Or do a CIFS mount of the Windows drive on your Linux system and copy to it that way.  Not sure if CIFS is included in default kernels though.  The advantage of the Samba approach is you don't need any kernel modules on the Linux side.

Of course, neither of these will work that well when the systems are so far apart that you can't use NetBIOS.  At that point, you should turn to WebDAV.  The Linux system can mount a WebDAV share via DAVfs.  Windows has native support for WebDAV as of IE5.  However, beware that Windows XP took a major step backward with regard to WebDAV.  Its easily accessible implemention of WebDAV sucks.  Microsoft hid the less sucky one.

To export the filesystem over WebDAV, you can use Apache's httpd with mod_dav, which is in the mainline for Apache2 and available as a third-party module for Apache1.3.  IIS supposedly supports exporting filesystems via WebDAV, but I've seen several reports that suggest it doesn't work quite right.  You're better off using Apache IMO.

Of course, if you'd just abandon Windows, you could use NFS and everything would work smoothly. ;)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Yegg

Thanks for the tip Kp. However I'll enjoy myself making a small Python script. :)

l)ragon

Quote from: Joe on November 12, 2005, 03:20 PM
Like iago said, system("cp <file1> <file2>");

In Visual Basic, what you're trying to do..
Dim sTmp As String
Open File1 For Input as #1
Open File2 For Output As #2
Do While Not EOF(#1)
  Input #1, sTmp
  Print #2, sTmp
Loop
Close #2
Close #1


I don't know any Pascal, so I can't help you there, but eh?

EDIT -
Here, a nice function! =)
Public Function CopyFile(File1 As String, File2 As String) As Boolean
    Dim Ret As Boolean, Tmp As String
    On Error Goto CopyFile_Error

    Open File1 For Input As #1
        Open File2 For Output As #2
            Do While Not EOF(#1)
                Input #1, Tmp
                Print #2, Tmp
            Loop
        Close #1
    Close #1

    CopyFile = True: Exit Function
CopyFile_Error:
    Call MsgBox("Error copying file." + vbCrLf + "Error number: " + Err.Num + vbCrLf + "Description: " + Err.Description)
    CopyFile = False
End Function

'// Usage:
If CopyFile("C:\Windows\cmd.exe", "D:\Windows\cmd.exe") = True Then
    Call MsgBox("File copied successfully.")
Else
    Call MsgBox("Error copying file.")
End If

.....

Sub FileCopy(Source As String, Destination As String)
    Member of VBA.FileSystem
    Copies a file
*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*ˆ¨¯¯¨ˆ*^~·.,l)ragon,.-·~^*ˆ¨¯¯¨ˆ*^~·.,¸¸,.·´¯`·.,¸¸,.-·~^*

EpicOfTimeWasted

Quote from: Kp on November 13, 2005, 10:59 AM
Of course, if you'd just abandon Windows, you could use NFS and everything would work smoothly. ;)

I actually use NFS to access my fileserver when I'm in Windows.  Win Services for Unix isn't overly terrible.  The only thing that bugs me about it is having the mount reconnect at startup.  It seems like Windows is trying to mount it before SFU is prepared to handle the mount requests, and then bitches about how it can't connect whenever I log in.  It still connects, just makes me hit enter to get rid of the stupid error message.

Skywing

Quote from: EpicOfTimeWasted on November 14, 2005, 02:19 PM
Quote from: Kp on November 13, 2005, 10:59 AM
Of course, if you'd just abandon Windows, you could use NFS and everything would work smoothly. ;)

I actually use NFS to access my fileserver when I'm in Windows.  Win Services for Unix isn't overly terrible.  The only thing that bugs me about it is having the mount reconnect at startup.  It seems like Windows is trying to mount it before SFU is prepared to handle the mount requests, and then bitches about how it can't connect whenever I log in.  It still connects, just makes me hit enter to get rid of the stupid error message.
Slightly offtopic, but beware of the NFS server in SFU 3.5.  There's a nasty bug in it that will cause it to hang your system occasionally that I finally tracked down some weird hangs on one of my computers to.

Some more information -

http://support.microsoft.com/default.aspx?scid=kb;en-us;895398
http://support.microsoft.com/kb/835152/

It looks like you still have to call in to get the hotfix though; annoying.

Banana fanna fo fanna

Yegg, I'd suggest just using HTTP. urllib, urllib2, and SimpleHTTPServer are your friends (in Python).

Yegg

Quote from: Banana fanna fo fanna on November 14, 2005, 09:00 PM
Yegg, I'd suggest just using HTTP. urllib, urllib2, and SimpleHTTPServer are your friends (in Python).
Yes, I know. But I wanted to create my own script that didn't require such modules. But I might just go ahead and take your advice, it will probably work out better that way.