|
-
Jun 17th, 2008, 04:34 AM
#1
Thread Starter
Lively Member
[2008]. File comparing, renaming and moving!
can some one pls assist me on this...
____________________________________
1. I want to rename a bunch of files...
the files are named like asasa$182829.rtf
-----I want to rename the file by removing the parts b4 $ sign!
-----I want to chk if there is 2 files with same name while renaming..that is there is no same file say $19299292...if it is there it should add a (2) at the end!
Then everything has to be moved to a directory, except the repeated ones!
Pls help!!!
Men have become the tools of their tools. - Henry David Thoreau
-
Jun 17th, 2008, 05:20 AM
#2
Hyperactive Member
Re: [2008]. File comparing, renaming and moving!
to remove som of the string you could use indexOf($), this will tell you where the first $ is in the string... then use, substring to get the new name..
vb Code:
Dim result As String = ""
Dim ost As String = "jgfdigjfdj$122836785"
result = ost.Substring(ost.IndexOf("$"))
first we check if the new filename exist, if not we add the (2), and then moves the file..
vb Code:
If IO.File.Exists(String.Format("c:\{0}.txt)", result)) Then
result &= "(2)"
End If
IO.File.Move(String.Format("c:\{0}.txt)", ost), String.Format("c:\{0}.txt)", result))
i havent checked to see if thjis code works, but you should be able to complete the code yourself...
-
Jun 17th, 2008, 06:21 AM
#3
Thread Starter
Lively Member
Re: [2008]. File comparing, renaming and moving!
that was helpful
Men have become the tools of their tools. - Henry David Thoreau
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|