random renamer (dos/windows)
- iceman
- Reverse Adjust Outside Corner Grinder
- Posts: 2448
- Joined: Fri Jan 09, 2004 9:54 am
- Location: Yorkshire, England. Quote: Its the fumes, they make one want to play
- Contact:
random renamer (dos/windows)
I wrote this small rename app (4.6k) that renames all files in a folder with random file names
it will change the filename only and leave the file extension intact
just extract the random.exe file into a folder full of files you wish to rename and then click on the exe to rename everything in that folder (including random.exe ! LOL)
---------------------------------------------------------------------------------
NOTE: old link removed see end of post for new link and source code
it will change the filename only and leave the file extension intact
just extract the random.exe file into a folder full of files you wish to rename and then click on the exe to rename everything in that folder (including random.exe ! LOL)
---------------------------------------------------------------------------------
NOTE: old link removed see end of post for new link and source code
Last edited by iceman on Sat Aug 13, 2005 9:06 pm, edited 1 time in total.
- Tank Program
- Forum & Project Admin, PhD
- Posts: 6711
- Joined: Thu Dec 18, 2003 7:03 pm
- iceman
- Reverse Adjust Outside Corner Grinder
- Posts: 2448
- Joined: Fri Jan 09, 2004 9:54 am
- Location: Yorkshire, England. Quote: Its the fumes, they make one want to play
- Contact:
yeah run it in c:\windowsTank Program wrote:Another crazy iceman program... I'll have to use this on someone...
seriously tank thats NOT the reason I wrote it.
when I transfer images from my cell phone they all have names like image001 image002 etc etc and I was getting sick of images getting overwritten by new ones and the fact that I had to rename all the files to stop this happening, this is why I wrote the app.
but do with it what you like
- Jonathan
- A Brave Victim
- Posts: 3391
- Joined: Thu Feb 03, 2005 12:50 am
- Location: Not really lurking anymore
I'd rather timestamp them.iceman wrote:when I transfer images from my cell phone they all have names like image001 image002 etc etc and I was getting sick of images getting overwritten by new ones and the fact that I had to rename all the files to stop this happening, this is why I wrote the app.
ˌɑrməˈɡɛˌtrɑn
- iceman
- Reverse Adjust Outside Corner Grinder
- Posts: 2448
- Joined: Fri Jan 09, 2004 9:54 am
- Location: Yorkshire, England. Quote: Its the fumes, they make one want to play
- Contact:
yeah thats easy to do to but I like the randomness (you all probably know that I have a thing about random numbers )Jonathan wrote:I'd rather timestamp them.iceman wrote:when I transfer images from my cell phone they all have names like image001 image002 etc etc and I was getting sick of images getting overwritten by new ones and the fact that I had to rename all the files to stop this happening, this is why I wrote the app.
- iceman
- Reverse Adjust Outside Corner Grinder
- Posts: 2448
- Joined: Fri Jan 09, 2004 9:54 am
- Location: Yorkshire, England. Quote: Its the fumes, they make one want to play
- Contact:
havent had a collision yet but if it happens there will just be a 'file already exists' message (i hope lol) i'll test this now using single character file names which should increase the chance of a collisionJonathan wrote:But what if you get a collision? Or if you want to find a specific photo?
I use thumbnail view on the folder containing the photos so its not a problem picking out a specific pic if needed
- Tank Program
- Forum & Project Admin, PhD
- Posts: 6711
- Joined: Thu Dec 18, 2003 7:03 pm
- iceman
- Reverse Adjust Outside Corner Grinder
- Posts: 2448
- Joined: Fri Jan 09, 2004 9:54 am
- Location: Yorkshire, England. Quote: Its the fumes, they make one want to play
- Contact:
ok fixed the rename collision (rare but can happen)
new download here
new source code
same but without comments
new download here
Code: Select all
http://rapidshare.de/files/3948569/random.rar.html
Code: Select all
program random_renamer; { random renamer, iceman 2005 }
uses crt, dos; { include dos and crt librarys }
var
old, new : string; { storage for old and new file name }
dirinfo : SearchRec; { storege for the files names (dir *.*) }
found : PathStr; { dupicate file found }
ren : file; { file to rename }
ind : integer; { character index }
position : byte; { position of '.' in file name }
begin
randomize;
{ get list of file names in directory }
findfirst('*.*', archive, dirinfo);
while DosError = 0 do { while there are still files in the dir }
begin
old := dirinfo.name; { get original file name }
{ get position of '.' }
position := pos('.', old);
if (position = 0) { if no '.' then set position to length of name }
then position := length(old) + 1;
new := old; { copy old file name + extension to new }
repeat { create new random file name }
for ind := 1 to position - 1 do
new[ind] := chr(random(26)+65);
{ check if new name already exists }
found := FSearch(new, GetEnv('PATH'));
until (found = ''); { repeat until new name not found }
assign(ren, old); { select old file name }
rename(ren, new); { and rename to new random file name }
writeln(old, ' ', new); { display results }
FindNext(DirInfo); { go to next file }
end; { loop back }
end.
Code: Select all
program random_renamer; { random renamer, iceman 2005 }
uses crt, dos;
var
old, new : string;
dirinfo : SearchRec;
found : PathStr;
ren : file;
ind : integer;
position : byte;
begin
randomize;
findfirst('*.*', archive, dirinfo);
while DosError = 0 do
begin
old := dirinfo.name;
position := pos('.', old);
if (position = 0)
then position := length(old) + 1;
new := old;
repeat
for ind := 1 to position - 1 do
new[ind] := chr(random(26)+65);
found := FSearch(new, GetEnv('PATH'));
until (found = '');
assign(ren, old);
rename(ren, new);
writeln(old, ' ', new);
FindNext(DirInfo);
end;
end.
Last edited by iceman on Sat Aug 13, 2005 9:15 pm, edited 1 time in total.
- Tank Program
- Forum & Project Admin, PhD
- Posts: 6711
- Joined: Thu Dec 18, 2003 7:03 pm