Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using shell to delete a file
#5
(04-24-2024, 08:26 AM)PhilOfPerth Wrote: It works! Thank you.
Now, onward and upward!  Big Grin
Is there a  function to create a "backup" of a file, (say myfilebak, from myfile)?

There are no commands to directly make copies or backup of files. But you could write one with a few lines of code like:

Code: (Select All)
' Copies src to dst
' Set overwite to true if dst should be overwritten if present
SUB CopyFile (src AS STRING, dst AS STRING, overwrite AS _BYTE)
    IF _FILEEXISTS(src) THEN
        IF NOT _FILEEXISTS(dst) OR (_FILEEXISTS(dst) AND overwrite) THEN
            _WRITEFILE dst, _READFILE$(src)
        END IF
    END IF
END SUB
Reply


Messages In This Thread
Using shell to delete a file - by PhilOfPerth - 04-24-2024, 06:43 AM
RE: Using shell to delete a file - by a740g - 04-24-2024, 06:48 AM
RE: Using shell to delete a file - by PhilOfPerth - 04-24-2024, 08:14 AM
RE: Using shell to delete a file - by PhilOfPerth - 04-24-2024, 08:26 AM
RE: Using shell to delete a file - by a740g - 04-24-2024, 10:05 AM
RE: Using shell to delete a file - by PhilOfPerth - 04-24-2024, 11:13 AM
RE: Using shell to delete a file - by Pete - 04-25-2024, 01:34 AM
RE: Using shell to delete a file - by PhilOfPerth - 04-25-2024, 05:04 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  code locks up when SHELL paulel 4 289 02-15-2026, 08:04 PM
Last Post: madscijr
  Breaking out of a Shell PhilOfPerth 3 546 07-02-2025, 02:59 AM
Last Post: PhilOfPerth
  Shell issues eoredson 7 1,343 05-10-2025, 02:59 AM
Last Post: eoredson
  Delete records in a random file Kernelpanic 2 700 05-27-2024, 04:04 PM
Last Post: Kernelpanic
  Having trouble Windows command line SORT via SHELL GTC 19 4,429 08-26-2023, 04:19 AM
Last Post: GTC

Forum Jump:


Users browsing this thread: 1 Guest(s)