Need the Import Scripts | file name append with date & time stamp
Hi Guys,
I need import action batch script to take the file name with (Date & Time details) and every time same file name keep on changing with updated date & time stamp.
Example: File name : Import_File_Name_30062020_0930.csv
and next time the file name to run the same import scripts is below:
File name: Import_File_Name_01072020_1030.csv
Thanks in advance
Best Answers
-
Please look at this thread (seems duplicate):
https://community.anaplan.com/t5/Anaplan-Platform/Integration-Anaplan-Connect/m-p/75428#M15594
0 -
================Working Script=================================
@Echo off
rem This example loads a source text file and runs an Anaplan import into a module.
rem For details of how to configure this script see doc\Anaplan Connect User Guide.docset AnaplanUser="username:password"
set WorkspaceId="Type WorkspaceID"
set ModelId="Type ModelID"
set DumpName="Client Location for Dumping the Errored data from Import"
set Chunksize=1for %%F in (E:\anaplan\filename_*.csv) do set filename=%%F
echo %filename%
pause
set Operation==-file "File_Name.csv" -put "%filename%"
set Operation=-service "https://api.anaplan.com" -auth "https://auth.anaplan.com" -file "File_Name.csv" -put "%filename%" -process "ProcessName" -execute -output "C:\Desktop\Archive\folderName"rem *** End of settings - Do not edit below this line ***
setlocal enableextensions enabledelayedexpansion || exit /b 1
cd %~dp0
if not %AnaplanUser% == "" set Credentials=-user %AnaplanUser%
set Command=.\AnaplanClient.bat %Credentials% -workspace %WorkspaceId% -model %ModelId% %Operation%
@Echo %Command%
cmd /c %Command%move E:\anaplan\filename_*.csv "C:\Desktop\Archive\"
pause=========================================================================================
0
Answers
-
Haven't done any such thing in the past. I am not even certain if that is the possibility in Integration activities as Anaplan Connect will look for the same file in the server. I might be wrong here but let's see what others have to say. @ben_speight can you help here.
.
1 -
Hey,
just a thought, what if you write script to rename file from Import_File_Name_30062020_0930.csv to Import_File_Name.csv in the same path before Anaplan connect script kicks in.
mv src_name dest_name
0 -
If you specify a server file using -file, the server file name is completely independent of the local file name (if you don't, the server file defaults to the local file name). If you use a YYYYMMDD format for the name, it is easier to sort them and find the most recent.
0 -
Thankyou0
-
Yes that can also work, in the end Anaplan Connect will look for a fixed name
0