You are not logged in.
Hi Denis, hi all,
i think there was an other thread (or post) about this topic but i didn't found it.
Denis, can you add an COPY rule?
Some times we want to COPY our files instead of renaming and/or moving the originals.
Maybe an new rule or option like "[ ] Make a COPY instead of MOVING / RENAMING"
Just an idea, what do you thing?
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
To tell you the truth, I have a special boolean flag inside ReNamer:
MyRenameCopyFiles: Boolean = False; // WARNING: Copy mode for renaming!!
It is just a matter of switching this flag to the TRUE state. BUT, I did not let user to choose just yet, because I'm just not ready to take responsibility of copying the files. This can introduce several problems. First, copying process will take much more time than the renaming process does, and because ReNamer is a single threaded application - there is no way to stop/cancel the operation OR to track the progress.
Few other people asked me that question in the past (over the email I think), so I had to tell them this: You can simulate this feature by creating a temporary copy of your files (manually), and then rename them as you would normally do.
Offline
begin
FileWriteContent(WideExtractFilePath(FilePath) + '(copy) ' + FileName, FileReadContent(FilePath));
end.
this wouldn't help???
There is just the known problem that, because of been a script it's executed on the preview.
Maybe the pascal could include a var to know that we are renaming or previewing
something like
begin
If WeAreRenaming then
FileWriteContent(WideExtractFilePath(FilePath) + '(copy) ' + FileName, FileReadContent(FilePath));
end.
--- EDITING ---
Nah, probably this last script would not work in the way I was thinking to keep the original name on the original file should be necesary to add after:
FileName:= WideExtractFileName(FilePath);
But Is very dangerous because
1. (now) it doesn't check if the destination file already exists
2. All the file is loaded into the memory and the computer will suffer a lot with large files
Any way I don't need this script, but I think a var like that could be very useful in other cases too...
Last edited by SafetyCar (2010-01-06 13:46)
If this software has helped you, consider getting your pro version. :)
Offline
Oh, sorry, the scripts are only executed on the preview not in the renaming...................... I forgot that
Last edited by SafetyCar (2010-01-06 13:50)
If this software has helped you, consider getting your pro version. :)
Offline
You are forgetting that rules are used ONLY during Preview to generate new names. Rename operation simply renames files according to the table. Hence, WeAreRenaming flag is not possible logically.
You can still simulate this in PascalScript by marking the rule only for final Preview. I can add "WideCopyFile" function, but this will still not solve the problem with possible conflicting paths.
EDITED: Just saw your previous post!
Last edited by den4b (2010-01-06 13:53)
Offline
OK, I don't know, I leave the "WideCopyFile" discussion to those who asked for copying...
I just don't need it . I was trying to help (Not with very good luck
)
Last edited by SafetyCar (2010-01-06 14:08)
If this software has helped you, consider getting your pro version. :)
Offline
I can add "WideCopyFile" function,
Please add it, at least un-documented / without official pronounce. For insiders only.
So we can playing around with it, and tell it only with warnings to requesters.
but this will still not solve the problem with possible conflicting paths.
Can't you re-use your function from the main renaming feature for this issue?
Can't you provide an parameter for the "WideCopyFile" function, like "WideCopyFile(oldName, NewName, force_on_conflicts)"
Just questions, no push!
An simple "WideCopyFile(oldName, FilePath + '\subFolder\NewName' + oldExt)" would be enough too.
Maybe Windows will anyway not allow to overwrite existing files.
Thanks for your offer.
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
Some time ago I did this to serialize a file if there is already other file in the drive with the same name.
Probably can be adapted to this problem
var
NewFileName: WideString;
Counter: Integer;
function needs_serialize(const S: WideString): Boolean;
begin
Result := True;
If Result then If FilePath=S then Result := False else Result := True;
If Result then If WideFileExists(S) or WideDirectoryExists(S) then Result := True else Result := False;
end;
begin
NewFilePath := WideExtractFilePath(FilePath) + FileName;
Counter := 2;
While needs_serialize(NewFilePath) do
begin
NewFilePath := WideCopy(FileName, 1, Length(FileName)-Length(WideExtractFileExt(FileName))) + ' (' + IntToStr(Counter)+ ')' + WideExtractFileExt(FileName);
Counter := Counter + 1;
end;
FileName := NewFilePath;
end.
So... by checking if the new path already exist you can avoid the conflict
- - - - -
Oh, the files on renamer list should be taken in account too.
Last edited by SafetyCar (2010-01-14 16:02)
If this software has helped you, consider getting your pro version. :)
Offline
Some time ago I did this to serialize a file if there is already other file in the drive with the same name.
Probably can be adapted to this problem
var NewFileName: WideString; Counter: Integer; function needs_serialize(const S: WideString): Boolean; begin Result := True; If Result then If FilePath=S then Result := False else Result := True; If Result then If WideFileExists(S) or WideDirectoryExists(S) then Result := True else Result := False; end; begin NewFilePath := WideExtractFilePath(FilePath) + FileName; Counter := 2; While needs_serialize(NewFilePath) do begin NewFilePath := WideCopy(FileName, 1, Length(FileName)-Length(WideExtractFileExt(FileName))) + ' (' + IntToStr(Counter)+ ')' + WideExtractFileExt(FileName); Counter := Counter + 1; end; FileName := NewFilePath; end.
>> If WideFileExists(S) or WideDirectoryExists(S)
That's already there?
I didn't have searched good enough
Then "WideCopyFile" could be used with more security.
Great find!
Read the *WIKI* for HELP + MANUAL + Tips&Tricks.
If ReNamer had helped you, please *DONATE* to Denis or buy a PRO license. (Read *Lite vs Pro*)
Offline
Yes that's it, and the previous line is because we only need to serialize if the file is different (not itself).
- - - - -
Mmmm in this case, as we are copying, could have sense to rename if the target is the same as the origin
Last edited by SafetyCar (2010-01-14 16:21)
If this software has helped you, consider getting your pro version. :)
Offline