Computer Science Canada

moving files

Author:  ReN3g@de [ Sat Feb 28, 2004 7:42 pm ]
Post subject:  moving files

ok i made a c++ program that does matrix code stuff... now i was wondering if its possible to make a turing program that will simply move the exe file into another directory... i am goin to zip this program and the c++ one together.

Author:  shorthair [ Sat Feb 28, 2004 7:45 pm ]
Post subject: 

there are commands in turing that start with

Flie.*******

just f9 file in turing and it should give you all the little things it can do, you can do exactly what you want it to

Author:  Tony [ Sat Feb 28, 2004 8:41 pm ]
Post subject: 

shorthair - enough with the spamming. Telling people to look up the answer themselves is not the best way to go Rolling Eyes

so to answer the question.
File.Copy (srcPathName, destPathName : string)
copies the file from srcPathName to destPathName. The destanation defaults to the current folder unless specified by the full path. Remember that you've got to use \\ (or /) in between folders.

you would then use File.Delete (filePathName : string) to delete the original file so it would be moved.

It is important to check if the copy was successful so that you dont lose the file.
code:

var fileNameOld : string := "c:\\turing\\old.t"
var fileNameNew : string := "c:\\notTuring\\new.t"

File.Copy (fileNameOld, fileNameNew)
if Error.Last = eNoError then
    put "File copied"
    File.Delete (fileNameOld)
else
    put "Did not copy the file."
    put "Error: ", Error.LastMsg
end if

Author:  shorthair [ Sat Feb 28, 2004 8:51 pm ]
Post subject: 

i thought we were trying to teach people how to use the turing referance, instead of asking silly questions , but if you would prefer it to be different thats alright with me ,

Author:  Tony [ Sat Feb 28, 2004 9:02 pm ]
Post subject: 

turing reference will take you only this far Rolling Eyes you know it as well as I do that its not the best place to look for answers... and oftentimes their example code doesn't even work Laughing

With turing reference you just lookup the syntax for parameters of the commands you already know. If you dont know the command, and expecially if you're required more then 1 of them for a given task (such as copy+delete to "move) reference is no help

Author:  Superskull85 [ Tue Apr 17, 2007 5:36 pm ]
Post subject:  RE:moving files

I get how to move a file (Copy then delete the file), but if, for example, I want to move a file to a removable device, like an iPod or PSP, is there anyway to find the drive the device is using. I want my program to be as user friendly as possible, so simply asking them for the drive their device is in wouldn't be to user friendly for people who don't know much about Windows based computers. Also the name of the drive would probably not always be named "Removable Disk" for what I want to do.


: