Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to move a file to another directory

Status
Not open for further replies.

Nifrabar

Programmer
Mar 16, 2003
1,343
NL
Hello to all of you !

I am updating my application.
Therefore I need (on the fly) move a file to another directory.
Would that be possible by one command ?
Or should I copy the file and delete the original ?

-Bart
 
HI

oFSO=CreateObject("Scripting.FileSystemObject")
oFSO.MoveFolder("SourceDir","DestinationDir")

:)


____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Ramani

Wouldn't your suggestion move the whole folder, rather than just the file?

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Oh Mike, I read the question wrong.

oFSO=CreateObject("Scripting.FileSystemObject")
oFSO.MoveFile(...............)

:)



____________________________________________
ramani - (Subramanian.G) :)
When you ask VFP questions, please add VFP version.
 
Ramani,
Thanks,
Will your solution run with all OS's ?
-Bart
 
Nifrabar,

You can use the RENAME function in VFP.

RENAME FileName1 TO FileName2

...the filenames can be fully qualified paths to the file and if the path to FileName2 differs from FileName1 then the file is moved. Such as:

RENAME ("C:\SourceFolder\MyFile.txt") to ("C:\DestinationFolder\MyFile.txt")

Slighthaze = NULL
craig1442@mchsi.com
"Whom computers would destroy, they must first drive mad." - Anon​
 
Hi,
Thanks to all.
I was ure there should be a (almost) single command for me.
But as with most things.. Just a how to.
-Bart
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top