You can use 'lsof' to do it and probably that's the same scheme which is used by Puppy.
But you have to know that it is still not 100% safe. Because a file system allows concurrent access, at one moment your check says the file is not opened, but as soon as you start the copying and deleting the copy on the ramdisk, another process starts opening it for modification or deletion. You can imagine it will result in various confusion to your file system.
Extron RGB-160XI Analog Computer Video 60-378-01
$187.06
Analog Computing The Magazine Atari Computer Owners February 1984 No. 16
$12.00
NEW Aquarius+ Computer Signature Edition - 8Bit Retro System
$209.00
Apple II V2 ANALOG VGA & Z80 PCPI Applicard Softcard PicoPal IIe Ralle version
$69.00
$18.00
Vintage Goodyear Electronic GEDA Analog Computer Plug -- Extremely Rare
$195.00
TRS80 Color Computer 1/2/3 Dragon 32/64 Atari Joystick Adapter
$25.49
CH Products MACH III Analog Joystick Beige Orange Black.** Untested **
$49.99
Apple 661-0287 5.25" Unidisk Analog CD Card Vintage 1986 820-0190-A
$154.00
2004 Honda Civic Engine Computer ECM ECU 37820-PLR-A72 OEM (AA 108)
$88.99