Large File Changing

How could you rename/delete/add/change multiple files or folders? For instance, maybe you had taken pictures at an event (such as a wedding) and you wanted rename all the files Wedding #. That of course is simply an example but is just something I was curious if it was possible.

Thanks
- Scott
Of course it's possible. See here:
http://www.cplusplus.com/reference/clibrary/cstdio/rename/

If you want to rename multiple files, use a loop.
Well ya, but can you simply just open and close new files? Actually, I'm not sure why I never thought of that *face palm* Thanks anyway
I believe in choosing the correct programming/scripting language for the correct problem. Requirement like rename/delete/add/change multiple files or folders is classic problem that shell scripts will suffice and coding is so much simpler. I would use Perl instead. I am not a XYZ programming language die-hard. I program according to the problem on hand and choose the correct and easiest tool/programming language for the job :)

PS Do you do regular expression using C++ ? I would stick to Perl instead :P
Or Python or Tcl...
It wasn't a real life problem, rather than a thought that came to mind. I know you can do something like this relatively easy in Ruby, but wondered if C++ would do the job as good, if not quicker.
find and sed.
find and sed


Not wanting to pour "cold" water but the command line option for sed can varies on different Unix platform. That was one of the reason why I would go for Perl instead since I know the code I write runs ok in different Unix platform as long as a Perl-compatible version is installed in them :)
The only reason I think of right now where it would make sense to do this in C++ is because you're storing the resources of a larger program on the file system and you need to manage them (e.g. delete them when you're done, move them someplace else, etc.). Or maybe if you're writing some sort of file manager, but writing a program that does nothing but a batch rename in C++ is absurd. It won't be faster, because the limiting element is the file system driver and the device, and it will actually take you longer because C++ doesn't have any standard interfaces to say, list files in a directory, or do a regex match/search.
Topic archived. No new replies allowed.