AppDeploy.com

 


Rename Files in a folder

Click here to associate this thread with a Package KB article.
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [AppDeploy Forums] >> Scripting >> Rename Files in a folder Page: [1]
Login
Message << Older Topic   Newer Topic >>
Rename Files in a folder - 2/9/2010 8:02:10 AM   
nokiak810

 

Posts: 12
Score: 0
Joined: 1/5/2010
Status: offline

Hi,

I have a 50 files in a folder which will contain a same name in the starting seperated by a dot and then the original filename.

How can i rename that group of files in that folder by the name after that dot in the file.

Eg:

testing.wardrope.txt
testing.bracket.txt
testing.braces.txt

Share your thoughts.




_____________________________

Thanks,
Nokiak810.
Post #: 1
RE: Rename Files in a folder - 2/9/2010 12:07:42 PM   
VBScab


Posts: 6623
Score: 190
Joined: 9/5/2006
From: London, UK
Status: offline
Use the Split function with the full-stop (period) as the separator, then use CopyFile to copy the original to the new name, followed by file deletion of the original.

Nice dodge: you can "access" the elements of the array returned by Split directly, as in:
strPart1 = Split(arrFilename, ".")(0)
strPart2 = Split(arrFilename, ".")(1)
and so on.


_____________________________

- Don't know why 'x' happened? Want to know why 'y' happened? ProcMon will tell you.
- Try using http://www.google.com before posting.
- I answer questions only via forums. PMs and personal emails will be ignored.

(in reply to nokiak810)
Post #: 2
Page:   [1]
All Forums >> [AppDeploy Forums] >> Scripting >> Rename Files in a folder Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI

0.031