Click here to Skip to main content
15,905,566 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I don't know how vague is my question.
can we make an application which takes in a folder location and rename's the files within(either by appending prefix/suffix)?

Any suggestion would be appreciated!

I just found few freewares here[^], but i am not allowed to use them at my desk.
Help me discover other ways!
Posted
Updated 19-Dec-11 23:44pm
v2

yes you can.....

1. Dirctory.GetFiles
2. For loop through the length of above result
a. File.Copy to the new name
b. File.Delete the file

Note : You have to correct FileIOPermissions to carry the above process.
 
Share this answer
 
Comments
Pramod Harithsa 20-Dec-11 5:54am    
Thanks :)
Check following example, it contains code as well.

http://www.dotnetspark.com/kb/4176-fetching-file-information-from-selected.aspx[^]

You just need to add code for rename file.
use File.Copy function with Same folder path as source and destination.
it will work like Rename!

Mark as answer, if it is useful.

Thanks
Dave Parth.
 
Share this answer
 
Comments
Pramod Harithsa 20-Dec-11 5:54am    
Thanks for the link :-)
Dave Paras 20-Dec-11 6:02am    
Thanks Pramod for mark as answer! :)
Pramod Harithsa 20-Dec-11 6:07am    
:-)
Of course you can write a program to do that - I've written just such a tool for my own use (and that probably would be completely useless to you).

I have to ask - if you're not allowed to use 3rd party programs, why would you be allowed to use something you wrote yourself? We can't even do that where I work.
 
Share this answer
 
Comments
Pramod Harithsa 20-Dec-11 6:01am    
since i belong to them. . so they don't consider me as third party unless i associate with a different brandname.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900