NightShade01
Member
- Joined
- Jul 7, 2006
- Messages
- 5
- Programming Experience
- 1-3
Ok so i'm trying to copy a file from one folder to another and i'm running into a problem. currently i know that in order to copy something you use the File.Copy( , ) method (assuming you import system.io.*) problem being the dest file can't be an exsisting file or directory. fine. I used a a loop to pull the file up and then tried the copy method. now my problem being that i'm getting a full path extension and not just a file name. Any one know how to cut the file name path apart without knowing how long the file is or it's name?
ie
problem i'm having is that myFile(i) where the comment is, i actually the value "C:\tmp\testing.doc" and the two paths are colliding. I need to get the myFile(i) to be just testing.doc
The only thing i can think of is indexOfLast? but doesn't that return an integer?
ie
VB.NET:
[LEFT]dim user as string
user = system.environment.username.tostring
directory.createDirectory("C:\Documents and Settings\" & user & "\Desktop\My Backup")
dim backupDest as string = "C:\Documents and Settings\" & user & "\Desktop\My Backup"
dim myFiles as String() = Directory.GetFiles("C:\tmp", "*.doc")
dim i as integerfor i = 0 to myFiles.GetUpperBound(i)
File.Copy(myFiles(i), backupDest & "\" & myFile(i)) //problem occurs here
next[/LEFT]
problem i'm having is that myFile(i) where the comment is, i actually the value "C:\tmp\testing.doc" and the two paths are colliding. I need to get the myFile(i) to be just testing.doc
The only thing i can think of is indexOfLast? but doesn't that return an integer?