Using this to protect files.
Security through obscurity is a bad idea, just to be clear.
Please could you do a script for symmetrical extension names, like .rar to rename to .rra, i.e swap 2nd and 3rd letter of extension only.
Have you tried modifying the script yourself to achieve this? You already have the building blocks, you just need to re-arrange them a bit. Official documentation could also come in handy.
Lastly, could I rename the extensions of every file on a hard drive using a batch file?
Sure, just save your rules as a preset and use command line options to execute a preset on any set of files, folders or even drives.
]]>Works like a charm.
Using this to protect files.
Please could you do a script for symmetrical extension names, like .rar to rename to .rra, i.e swap 2nd and 3rd letter of extension only.
Lastly, could I rename the extensions of every file on a hard drive using a batch file?
for example :
automaticaly search and rename all of these file types [txt rar xls xlsx ppt doc docx jpeg avi mp3 mts..........etc] on a particular hard drive, e.g c drive. d drive, f drive?
Many thanks
]]>var
I, Count: Integer;
Ext, NewExt: WideString;
begin
Ext := WideExtractFileExt(FileName);
NewExt := Ext;
Count := Length(Ext);
for I := 2 to Count do
NewExt[I] := Ext[Count - I + 2];
FileName := WideExtractBaseName(FileName) + NewExt;
end.
Could you write one that only reverses the extension name?
e.g. report.xls becomes report.slx
or kid.jpg = kid.gpj
thanks
]]>Thanks for sharing! *metrytolearn*
.
]]>Filename "s~#sartxE" will require usage of a script (below), to invert the name, which will give you "Extras#~s". Then, you can use Delete rule to delete everything after the # character.
var
I, Count: Integer;
Temp: WideString;
begin
Temp := FileName;
Count := Length(Temp);
for I := 1 to Count do
FileName[i] := Temp[Count - I + 1];
end.
''s~#Unknown#~s''
was formerly this:
''Unknown''
Other times the names are reversed. Like that:
''s~#sartxE''
used to be that:
''Extras''
I have to specify, I already tried using PascalScript and the ''Remove feature'' so it may conflict if I try to do it again.
]]>The original problem was caused by a utility called "Folder Lock" which is an encryption program
that locks up a certain file folder and opens it upon entry of password.
Somehow the file got messed up and when it was opened next, thousands of files were misnamed.
Fortunately they all had the same mis-naming pattern, which was reversal of the filename completely,
and 3 characters as a prefix.
For example:
Windowshurts.jpg
was "encrypted" to
s~#gpj.struhswodniW
How can i rename them back?
---
Answer:
To repair the filename for good
FROM:
s~#gpj.struhswodniW
s~#gpj.retsneF seualB
s~#gpj.muartnetülB
s~#pmb.ellydI enürG
s~#fdp.launaM tpircS lacsaP
s~#fdp.ediuG kciuQ
s~#fdp.launaM resU
TO:
Windowshurts.jpg
Blaues Fenster.jpg
Blütentraum.jpg
Grüne Idylle.bmp
Pascal Script Manual.pdf
Quick Guide.pdf
User Manual.pdf
you can do this with den4b ReNamer by using an PascalScript Rule
Here is the script:
var
I: Integer;
new: WideString;
begin
//--- FileName example: s~#gpj.struhswodniW
//-------------------------------------------------
//Revers the string:
For I:=1 to Length(FileName) do
new := FileName[i] + new;
//--- new example: Windowshurts.jpg#~s
//-------------------------------------------------
//remove last 3 signs, the trailing '#~s'
Delete( new , Length( new )-2 , 3 );
//--- FileName example: Windowshurts.jpg
//-------------------------------------------------
//set the FileName to what is stored in var new:
FileName := new;
//-------------------------------------------------
//emtpy 'new' for the next filename
new :=''
end.
Or in short:
var
Char: Integer; NewName: WideString;
begin
For Char := 1 to Length(FileName) do
NewName := FileName[Char] + NewName;
Delete( NewName , Length( NewName )-2 , 3 );
FileName := NewName; NewName :='';
end.
See the wiki how to do this: http://www.den4b.com/wiki/ReNamer:Rules:PascalScript
See the WIKI for more about using Rules: http://www.den4b.com/wiki/ReNamer:Rules
HTH?
---
Solved:
1800+ files were renamed in a matter of seconds. approximately 30 directories.
var
I, Count: Integer;
Temp: WideString;
begin
Temp := WideExtractBaseName(FileName);
Count := Length(Temp);
for I := 1 to Count do
FileName[i] := Temp[Count - I + 1];
end.
var
Temp, BaseFilename : WideString;
i,k : Integer;
begin
BaseFilename:=WideExtractBaseName(FileName);
Temp:='';
i:=1;
for k:=Length(BaseFilename) downto 1 do
begin
WideInsert(WideCopy(BaseFilename,k,1), Temp, i);
i:=i+1;
end;
FileName:=Temp + WideExtractFileExt(FileName);
end.
If it's not that you need to be more specific. Especially real examples are welcome.
]]>