Drexel dragonThe Math ForumDonate to the Math Forum

Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.

Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: rename file numeration
Replies: 4   Last Post: Jan 9, 2013 10:30 AM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Jan Simon

Posts: 2,923
Registered: 10/6/08
rename file numeration
Posted: Jan 9, 2013 10:18 AM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Dear Engineer,

Stars are not allowed in file names.

> close all % Why closing all windows?!
> clear all % Useless almost ever. Ehy removing functions from the memory?!
> clc % Really?

dirData = dir('*.jpg');
fileNames = {dirData.name};
for iFile = 1:numel(fileNames)
newName = sprintf('%08d-%02d.jpg', floor((iFile - 1) / 25, rem(iFile - 1, 25) + 1);
movefile(fileNames{iFile}, newName);

Please test this. Some of the +-1 could be confused.

Kind regards, Jan

Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2015. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.