Windows Equivalents for Shell: cp (copy)

Phil Davis revdev at pdslabs.net
Wed Jul 13 01:12:06 EDT 2016


 From the dictionary:

    The rename command can be used to change a file's or folder's
    location only if the old and new locations are both on the same volume.

Phil Davis


On 7/12/16 5:23 PM, Roger Eller wrote:
> I thought the rename command allows for a different destination.
> Therefore, rename is actually "copy as new name" when the volumes or drive
> letters differ.
>
> ~Roger
> On Jul 11, 2016 11:19 PM, "Sannyasin Brahmanathaswami" <brahma at hindu.org>
> wrote:
>
>> 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
>>
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

-- 
Phil Davis




More information about the use-livecode mailing list