HomeForum
Welcome, Guest

Rename file after processing
(1 viewing) (1) Guest
  • Page:
  • 1

TOPIC: Rename file after processing

Rename file after processing 1 year, 1 month ago #2668

  • Pol
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 0
Hello!

I'm creating a package.

Once the transformation is done, I want to move the CSV files to another folder and then rename them.
I have successfully moved the files using and my problem is renaming it.
How can I do this?
I tried using the Zip File action. It turned out ok. I zipped the files and moved it into a new directory.

How to rename an existing file using transformation?
I just want to change its extension form .csv to .processed

Pol

Re: Rename file after processing 1 year, 1 month ago #2670

  • admin
  • OFFLINE
  • Moderator
  • Posts: 2182
  • Karma: 12
Yes it is possible, using script action

1. create new package
2 add script and use this script

var i: integer;
Rec : TSearchRec;
Attr : integer;
SearchDirectory,TargetDirectory,Mask : string;
begin
SearchDirectory:='c:\';
Mask:='*.csv';
TargetDirectory:='c:\temp\';
Attr := faReadOnly+faHidden+faArchive+faAnyFile;
if FindFirst(SearchDirectory+Mask,Attr,Rec) = 0 then
try
repeat
if ((Rec.Name='..') or (Rec.Name='.'))=false then
begin
RenameFile(SearchDirectory+Rec.Name,TargetDirectory+ChangeFileExt(Rec.Name,'processed'));
end;
until FindNext(Rec) <> 0;
finally
FindClose(Rec);
end;
result:=true;
end;


Mike

Re: Rename file after processing 1 year, 1 month ago #2671

  • Pol
  • OFFLINE
  • Fresh Boarder
  • Posts: 3
  • Karma: 0
Thank you for quick reply

It works now

Pol
  • Page:
  • 1
Time to create page: 0.16 seconds

Testimonials

We were able to validate more data in less time when we started using Advanced ETL Processor

N.Chad
IT Manager

User Login

You only need to log in or register to use our support forum



Our customers

BP

BBC

HSBC


Databases we work with

Go to top