Before trying out the "hardcore" no-extra-tools method I describe below, check if your Optiplex has a PATA port available inside - in which case, likely all you need is an adapter for a 2.5" PATA drive (the plugs are different in 2.5" vs 3.5"/5.25" PATA form factors...) and you can just remove the harddrive from the laptop and access it in the Optiplex. If anything nonessential (CD drive?) is already on the PATA bus, disconnect it unless you know what you are doing with PATA, the Master/Slave/CS mechanics could complicate things.
There were laptops that used harddrives on the ancient ST506 or ESDI interfaces - try to check that beforehand (google the model number on the harddrive and get a spec sheet), do not attempt to connect such a drive to a PATA machines.
Or, you could get a PATA to USB adapter, they are not expensive.
The ports are accessible as device files under DOS (COM1...x , LPT1...x), and can be used as a target for a COPY command or a redirected TYPE command. On the linux end, the ports are also accessible as device files (/dev/ttyS0..x, /dev/lp0..x), and can be read from, eg with "cat /dev/ttyS0 >> some.file.txt".
These will need a null modem cable for serial transfer (if you have a normal serial cable that you can physically connect, try swapping the wires to pins 2 and 3 on the 9 pin end), or a corresponding parallel cable (which is rare, most of them had a centronics plug on the other end which doesn't mate to a PC parallel port physically). Actually, any wire hookup connecting pins 2 and 3 crossed and pin 5 to pin 5 (assuming 9 pin pinout) should work on serial if you keep the wires short and close together. Let's ignore parallel for now, since you would need to set up STROBE/ACK signalling correctly to work with the DOS device drivers...
In case of using serial ports, you will need to configure the ports on both computers, with stty on the linux side and MODE on the DOS side. Note that these configuration settings are NOT persistent across reboots. I would suggest trying 115200,8,o,1 and downgrading the speed if it doesn't work - i'd keep the parity on, though, since it is there for detecting errors caused by electrical interference. Also, make sure that there is no kind of newline translation mechanism set active (I do not know if some DOS versions manage such via the MODE command).
If you need to transfer multiple files, your best bet is combining them into an archive - if PKZIP is available on the DOS machine, it can be unpacked with the "unzip" or "zip x" commands on the linux side. However, you might need to repeat the transfer in the worst case, serial communication can be not 100% reliable against interference.
6Laplink used to be the gold standard for this. You could connect over serial and parallel ports. If your hard drive is too old to be compatible with the USB adapter as suggested in the answer below, dig up an old copy of Laplink. – Brad – 2017-11-11T19:47:31.337
@Brad Yes, I'd suggest Laplink via serial or parallel with a third machine that has one of these and also has an Ethernet port (assuming the ultimate target computer still has Ethernet) – Hagen von Eitzen – 2017-11-11T22:19:56.297
@Brad My answer was about laplink, although i didnt specifcally name it. the problem is you still have to purchase it. the IDE to usb adapter is a better choice IMO – Keltari – 2017-11-11T23:32:34.163
Not even a network or modem port? I've used networking before with old or USB crippled computers. But I guess getting networking going on dos or win3.1 might not be very easy either, but there is linux... Anyway, removing the data/drive is probably the easiest, +1 to Keltari's answer – Xen2050 – 2017-11-12T03:53:58.033
You can create a TCP/IP connection between Windows computers using a parallel cable. The speed is around 1 Mbps, IIRC. However, I'm not sure if this is possible with Windows 3.1. I don't remember there being a TCP/IP stack in Windows 3.1, though, IIRC, Windows 3.11 for Workgroups had it. Here are the instructions for doing this on Windows XP. I did it many times back in the 90s. It was much faster than phone modems or serial cables.
– reirab – 2017-11-12T06:39:01.150you may find some good information in https://retrocomputing.stackexchange.com/
– phuclv – 2017-11-12T06:58:48.940Laplink would probably need a floppy to put on the machine, unless you can dig up an actual physical copy... – rackandboneman – 2017-11-12T23:21:04.480
1Have you looked into PCMCIA LAN cards? You'll need a fairly old one to get driver support - and you'll need a floppy disk with the driver. Same problem for laplink though - you need a floppy disk to set it up – gnibbler – 2017-11-12T23:55:09.037
3Is this a one time task or you want the old computer working and exchanging files? Because if it is a one time task you can extract the HDD and mount it as a pen drive with a PATA-USB adapter. (it is reported to have 250mb hard drive... so few seconds in that way) – Hastur – 2017-11-13T09:49:54.117