Hi All,

I am new to programming world,

i wanted to make a script which will create folder when counting of files breaks.

for Example-

1) I have 1000 no of jpg files in a single folder.(but )
2) but these files has a number break in between. (like it will start from 0001 to 0150 and again will start from 0165 to 500 ,and so on )
3) i wanted to move the break files in to a new folder, and continue to search for new break files.

I am working with film and television industries.

Here we gets a Jpg or Tga sequences of movie but not sequencial so we have to search manually for sequence break and move that files in to a folder.

Kindly help me with any script or small programme.


well this is the c++ forum, and the reality is that you are going to want a perl/python/ruby/other scripting language. C++ can do it but you are going to write a lot of code to do that. C++ wins out when you have numerics, system level, memory issues, and often code size -- it seems easier to organize than a perl script!

If it is perl, you might want something like:

my @files= split `ls *.jng`;
my $last=0;
for(my $i=0;$i<#$files;$i++)
       if ($files[i]=~/(\d+)/)
             rename($files[i],"newdirectory/".$files[i]) if ($1!=$last+1);

NOTE: I do the occasional perl script, I am sure the real perl masters, produce code that is a million times better/robust etc.

Moderators: I believe that this question would be better under perl or scripting languages.