move all files in directory? MoveFileEx?

I'm trying to find a way to move all files in a directory. I found the api function,MoveFileEx, but i only see a way of moving a single directory or file. Is there a way to do the following:
MoveFileEx("c:\existingdir\*", "c:\newdir\*", MOVEFILE_REPLACE_EXISTING);

[493 byte] By [hippofear] at [2007-12-16]
# 1

Hi hippofear,

In .NET, you can move files using managed code without the API Call.
See code snippet below:


Dim objDirectoryInfo As New DirectoryInfo("C:\existingdir")
Dim arrFileInfo As FileInfo()
Dim intLoop As Integer
arrFileInfo = objDirectoryInfo.GetFiles()
Dim strDestinationFolder As String = "C:\newdir\"

For intLoop = 0 To arrFileInfo.Length - 1
File.Move(arrFileInfo(intLoop).FullName,
strDestinationFolder + arrFileInfo(intLoop).Name)
Next


This moves one file at a time, the only way to move all files would be to use shell commands such as move from the command prompt.

Regards,
Vikram

Vikram at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified