Below is a PascalScript code for ReNamer which will create a Readme.txt file in every processed folder.
The script is executed during the preview, so for safety it will ask you whether to create Readme.txt or not every time you preview. This script uses ReadmeText
constant for the content, but it could also be made that it copies the content of Readme.txt file from a file on your system. It will only create a Readme.txt file if one does not already exist. Drop all your folders into ReNamer and use this script.
const
ReadmeName = 'Readme.txt';
ReadmeText = 'Content of Readme file goes here!';
var
Initialized: Boolean;
ReadmePath: WideString;
DoCreateReadmeFile: Boolean;
begin
if not Initialized then
begin
Initialized := True;
DoCreateReadmeFile := DialogYesNo('Create Readme file this time?');
end;
if WideDirectoryExists(FilePath) then
ReadmePath := WideIncludeTrailingPathDelimiter(FilePath)
else
ReadmePath := WideExtractFilePath(FilePath);
ReadmePath := ReadmePath + ReadmeName;
if DoCreateReadmeFile and not WideFileExists(ReadmePath) then
FileWriteContent(ReadmePath, ReadmeText);
end.
Edit
Script below will take a source file defined by SourceFilePath
and copy it to the target folders. It will also warn you if source file does not exist.
const
TargetFileName = 'Readme.txt';
SourceFilePath = 'C:\Temp\Readme.txt';
var
Initialized: Boolean;
TargetFilePath: WideString;
DoCreateFiles: Boolean;
begin
if not Initialized then
begin
Initialized := True;
if WideFileExists(SourceFilePath) then
DoCreateFiles := WideDialogYesNo('Create "'+TargetFileName+'" files this time?')
else
WideShowMessage('Source file does not exist!'+#13#13+SourceFilePath);
end;
if WideDirectoryExists(FilePath) then
TargetFilePath := WideIncludeTrailingPathDelimiter(FilePath)
else
TargetFilePath := WideExtractFilePath(FilePath);
TargetFilePath := TargetFilePath + TargetFileName;
if DoCreateFiles and not WideFileExists(TargetFilePath) then
WideCopyFile(SourceFilePath, TargetFilePath, False);
end.