Guys,
Just a quick question.
Is there a way, how to set Move File activity, to move and rename the file according to current date ?
May something like this be used in the output ? (“{0:yyyy/MM/dd}”, DateTime.Now)
Thank you in advance.
- Destination - The destination path where the file is to be moved.
Please enter the full path including file name in the Destination.
strnewFileName = "file_" + DateTime.Now.ToString("yyyyMMdd") + ".doc"
Thank you for your quick response, however I might need a little correction
“A:\IT\MARTIK03\TEST\Status Changes.xlsx” strnewFileName = “Status Changes_” + DateTime.Now.ToString(“yyyyMMdd”) + “.xlsx”
The highlighted part is a full path with file name.
Hi @Martin_Kral
You can simply extract the path without file extension.
Strpath = fullpath.Substring(0, filename.Length - “xlsx”.Length)
Newfile = Strpath + “_” + ......
Regards,
Karthik byggari
Im lost now :) Could you advise me, how my **Move File** destination should look like ? Along with full path and attribute to file rename. PS : I
m newbie
- Consider your file path is stored in the below string variable.
strFilePath = "A:\IT\MARTIK03\TEST\Status Changes.xlsx"
- Assign Activity for setting new file path with a date (create one string variable).
strnewFilePath = strFilePath.Substring(0, strFilePath.Length - 5) + "_" + DateTime.Now.ToString(“yyyyMMdd”) + “.xlsx”
After assign activity, strnewFilePath contains the following value -
A:\IT\MARTIK03\TEST\Status Changes_20190417.xlsx
- In the properties of Move File Activity, set the following
- Path - strFilePath
- Destination - strnewFilePath
Regards,
Karthik Byggari
strnewFilePath = strFilePath.Substring(0, strFilePath.Length - 5) + “_” + DateTime.Now.ToString(“yyyyMMdd”) + “.xlsx”
Hi @Martin_Kral,
first assign file name to a variable like
fileName = Path.GetFileName(“the file path”)
then manipulate the variable fileName as required. (means adding date)
then append the fileName variable to new path where the file to be stored.
@KarthikByggari
It works !!! Thank you very very much for your support and patience
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.