Move CSV file to different location

Hello,

If I have a csv file that is stored in my downloads folder and the name of the csv file changes every time the program runs how would I move that csv file to a different location in file explorer. I tried using the move file activity but it does not keep the format of the csv file when it moves the file.

Thank you in advance for your help!

@Sahil_J_Patel - have you tried the solution provided from your previous post…

So for that question I was reading the data from each csv file and did not need to move the file anywhere. This time I need to just take the file from downloads and move it to a different folder/directory.

@Sahil_J_Patel - Say if only one file gets created everyday which you wants to move from downloads to different folder…here is the code…

StrCSV = Path.GetFullPath(Directory.GetFiles(Environment.ExpandEnvironmentVariables("%USERPROFILE%\Downloads"),"*.csv").OrderByDescending(Function(d) New FileInfo(d).LastWriteTime).First)

above code pull the very recent file from the downloads folder which you can pass it to Move File activity…

In the example above I am moved to my desktop…

Environment.ExpandEnvironmentVariables("%USERPROFILE%\desktop")

image

Hope this helps…

Thank you Prasath, it worked!

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.