The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.
|
 |
|
Dev Shed Forums
> Programming Languages
> C Programming
|
How to rename multiple files in a folder at once?
Discuss How to rename multiple files in a folder at once? in the C Programming forum on Dev Shed. How to rename multiple files in a folder at once? C programming forum discussing all C derivatives, including C#, C++, Object-C, and even plain old vanilla C. These languages are low level languages, and used on projects such as device drivers, compilers, and even whole computer operating systems.
|
|
 |
|
|
|
|

Dev Shed Forums Sponsor:
|
|
|

October 21st, 2012, 02:18 PM
|
|
Registered User
|
|
Join Date: May 2012
Location: Bokaro Steel City, India
Posts: 4
Time spent in forums: 2 h 10 m 25 sec
Reputation Power: 0
|
|
How to rename multiple files in a folder at once?
Hi friends!
I have a folder containing a lot of songs, all in mp3 format. I want to create a program to rename them at once using a definite pattern.
Right now I only know how to rename a file using the rename function.
Please guide me in the right direction. I just want to know how to read a folder / directory for the files contained in it. I do not want you to code the whole program. Just guide me by naming some functions that are useful in this case.
Any help is appreciated! 
|

October 21st, 2012, 02:41 PM
|
|
Contributing User
|
|
Join Date: Oct 2012
Posts: 71
Time spent in forums: 1 Day 7 h 39 m 39 sec
Reputation Power: 1
|
|
|
Which operating system are you using?
|

October 22nd, 2012, 12:19 AM
|
|
Registered User
|
|
Join Date: May 2012
Location: Bokaro Steel City, India
Posts: 4
Time spent in forums: 2 h 10 m 25 sec
Reputation Power: 0
|
|
|
Microsoft Windows XP
(32 bits, SP2)
Also, I am using MVC++ 6.0.
Last edited by TheAliveWinner : October 22nd, 2012 at 12:34 AM.
Reason: Provided incorrect info by mistake! :(
|

October 22nd, 2012, 01:09 AM
|
 |
Contributed User
|
|
|
|
How to get a list of files
Given a filename in a string like say
std::string filename = "file01.mp3";
do you know enough string operations to create
std::string new_filename = "file - 01.mp3";
Then you just do
rename( filename.c_str(), new_filename.c_str() );
|

October 22nd, 2012, 08:42 AM
|
 |
Contributing User
|
|
|
|
|
install cygwin, use bash
$ for f in *.mpg ; do echo mv $f ${f!} ; done
when you get ! correct either remove echo or pipe the works to bash.
__________________
[code] Code tags[/code] are essential for python code!
|

October 22nd, 2012, 01:17 PM
|
|
Registered User
|
|
Join Date: May 2012
Location: Bokaro Steel City, India
Posts: 4
Time spent in forums: 2 h 10 m 25 sec
Reputation Power: 0
|
|
Thank you, friends! 
|
Developer Shed Advertisers and Affiliates
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Rate This Thread |
Linear Mode
|
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|