The Math Forum

Search All of the Math Forum:

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

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

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

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,927
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 = {};
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]

© The Math Forum at NCTM 1994-2018. All Rights Reserved.