Want to use Shell Move command

Deploying to Windows? Utilizing VB Script execution? This is the place to ask Windows-specific questions.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Want to use Shell Move command

Post by keyless » Tue Apr 08, 2008 5:20 am

I can't for the life of me get the Dos Move command using shell in rev to work.
and after hard searching have come up with very little info.

I have 2 variables, one is the file path = fPath other is destination folder path = destFolderPath

As this works fine in cmd.exe: move "C:\test folderA\testfile.txt" "C:\test folderB I've tried several ways to put that into a working shell command in rev with no luck.

I imagin this is pretty easy, but once again lack of info is holding me back.

for one thing the the examples in the documentation don't even look like they cold work, wouldn't a put or open be needed ???

logically in my case something like:
open shell(move fPath destFolder Path)

UPDATE: I think i got it I built the whole thing quotes move and all into one variable before hand.

I would still like more info on this if possible.

Janschenkel
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 977
Joined: Sat Apr 08, 2006 7:47 am
Location: Aalst, Belgium
Contact:

Post by Janschenkel » Tue Apr 08, 2008 5:48 am

You have to properly combine the data into a string that looks exeactly like what you would type at the DOS prompt. S that owould look like:

Code: Select all

put "move && quote & fPath & quote && quote & destFolderPath & quote into tShellCommand
get shell(tShellCommand)
Though if your goal is to move a file, you can use the 'rename' command:

Code: Select all

on mouseUp
  answer file "Pick a file to move to the desktop"
  if it is empty then exit mouseUp
  put it into tFilePath -- UNIX style filepath
  set the itemDelimiter to "/"
  put item -1 of tFilePath into tFileName
  put specialFolder("desktop") & "/" tFileName into tDestFileName
  rename file tFilePath to tDestFileName
end mouseUp
Make sure to use the proper file path formats: internaly, Revolution uses UNIX style paths - so if you get a file path from the 'ask file', 'answer file' or 'answer directory' commands, you'll have to convert these to platform-specific paths before using the 'shell' function or assembling applescript or vbscript statement lists.
See also the 'revMacFromUnixPath' and 'revUnixFromMacPath' functions - in case of Windows, you can simply replace "/" with "\" in the filepath to cobvert from Unix to Windows paths.

Hope this helped,

Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com

keyless
Posts: 211
Joined: Wed Dec 12, 2007 11:21 pm

Post by keyless » Tue Apr 08, 2008 6:16 am

yep the replace "/" with "\" in lMover was the real blocker (I should have remembered that I got that from another kind sole on this list, 47 questions ago.


I don't want to use rename for two reasons, 1 it only works on same volume, and 2 it resets the last Modified property of the file (of critical importance when working with backup files).

I had been using revcopyfile (its really just a glorified DOS copy in windows), but that is slow with large files and having to have a delete command (even with good checks) didn't sit well.

I got Move working now and it works great and fast

Once again thank you for your great info.

Post Reply

Return to “Windows”