Renaming dynamic file name using batch script

Closed
sriharsha711 Posts 2 Registration date Wednesday June 12, 2013 Status Member Last seen June 12, 2013 - Jun 12, 2013 at 11:57 AM
 Blocked Profile - Jun 12, 2013 at 03:14 PM
Hi,

I have an incoming file every month which is of the format MMDDYYYYDealer.txt. I need to rename it prior to processing by informatica to some common name such as Dealer.txt so that I can use it in my Source connection. Please let me know what commands I can use or it would be great if anyone can share the script

3 replies

Blocked Profile
Jun 12, 2013 at 03:14 PM
This is created in notepad, and saved as .bat file
Be certain to change the file paths to those that are specific to your environement
where z is your mapped drive to "Informatica Secure"

@echo off
set /p txtfile=Filename without Path assumes c:\:
echo.%txtfile%
copy %txtfile% z:\testing\dealer.txt
echo Come back to this window when Agent is done with process. The copy file will be deleted.
@pause
copy %txtfile% c:\somefolder\namedsuccess\%txtfile%
del z:\testing\dealer.txt
exit

I hope this helps.
2
Blocked Profile
Jun 12, 2013 at 12:33 PM
I hope this reply finds you in good spirits.

Incoming file into where? Your email client? Your mapped drive?

I will be happy to assist once I understand the environment.

0
sriharsha711 Posts 2 Registration date Wednesday June 12, 2013 Status Member Last seen June 12, 2013
Jun 12, 2013 at 01:15 PM
Hi Mark,

Sorry I wasn't a bit more specific.

I have an incoming file every month(Would be placed in my Informatica Secure agent machine using Windows XP) which is of the format MMDDYYYYDealer.txt. I need to rename it prior to processing by informatica to some common name such as Dealer.txt so that I can use it in my Source connection.After the processing is done I need to move the file with the original name to a specified folder

So lets say I receive 12022013Dealer.txt in my folder
I copy this to a new folder
rename the file in my original folder
After Informatica Processing I will move the copied file with original name to a success folder and delete the renamed file.
0