Q: We’re trying to create subfolders ahead with a rule in a following format: 2021\11 Nov21
Is it possible to do this with an empty rule eg there’s no source file to move/copy? What would be the best way to handle this? Many thanks
A: This is possible using our ‘Pascal Script’ as Source option. In this case no source files are needed.
First add ‘Pascal Script’ as Source:
Add the following Pascal Script code. Do not forget to adjust the ctPath const, end with a \
Var
tmpSubPath: String;
Const
ctPath = 'C:\Test\Out_PSC\';
Begin
psExitCode:= 1;
// Create subfolders in the following format: 2021\11 Nov21
tmpSubPath := FormatDateTime('YYYY\DD MMMYY', Now);
If ForceDirectories(ctPath + tmpSubPath) then
psLogWrite(1, '', 'Create Directory: ' + ctPath + tmpSubPath + ', Successful')
Else
psLogWrite(1, '', 'Create Directory: ' + ctPath + tmpSubPath + ', Error')
End.
This script will create a single subfolder when it is triggered using the current date. Of course it can be modified so it fits your needs, just let us know.
Update, received the following question from user: Is there a way to add +1 to either month or date so I can adjust as required?
#FileTransfer
Best regards,
Limagito Team