Windows Equivalents for Shell: cp (copy)

Sannyasin Brahmanathaswami brahma at hindu.org
Mon Jul 11 23:18:54 EDT 2016


What alternatives do we have for basic shell commands on Windows?

Rumors are out that later this year, Windows will support bash.. and perhaps then Livecode's shell calls to unix/bash commands will be cross platform--  like the one (cp) in this script below. But until then, can anyone provide an alternative that works on Windows?

RevCopyFile (which works on Windows) doesn't offer the option to copy to a different filename…

I suppose I can copy the file and then rename the copy at the new destination, using "rename"  which is simple enough.

But I was wondering if there are any native windows alternatives to unix "cp" that writes the same file to another file with a different name in "one go."


on backupStack

save the topstack

# get a time stamp

put the internet date into tDateTime

convert tDateTime to dateitems

delete the last item of tDateTime

if item 4 of tDateTime > 12 then

subtract 12 from item 4 of tDateTime

put "pm" into the last item of tDateTime

end if

replace comma with "-" in tDateTime

# get the path of the stack

# set up the copy

put the effective filename of the topstack into tCurrentPath

put tCurrentPath into tCopyPath

set the itemdel to "/"

# always back up to one level above current working folder

delete item -4 to -2 of tCopyPath

put "/zArchives" after item -2 of tCopyPath

# put tCopyPath; exit to top;

replace ".livecode" with ("_" & tDateTime & ".bac") in tCopyPath

put ("cp " & quote & tCurrentPath & quote &" "& quote & tCopyPath & quote) into tShell

get shell(tShell)

# auto fire every half hour

send backupStack to me in 1800 seconds

end backupStack




More information about the use-livecode mailing list