Skip to main content
Solved

Copy random .csv file to one name.

  • September 18, 2023
  • 3 replies
  • 57 views

garbadek
Contributor
Forum|alt.badge.img

I have about a hundred or so .csv files. They all live in different folders on the same network. In a database table I have the path and name of each file (something like: "M:\\ExampleFolder\\Example.csv"). As I process each record, I just want to copy each source .csv file to a folder called "D:\\Temp" and rename it "Final.csv". So "M:\\ExampleFolder\\Example.csv" would get copied to "D:\\Temp\\Final.csv" when that record was processed. The next record in the table might be "D:\\ATotallyDifferentFolder\\Different.csv". When that record gets processed I want that file to replace/become the new "D:\\Temp\\Final.csv". I can't seem to figure out how to use the File Copy writer to do this. Any help would be appreciated. Thank you.

Best answer by nielsgerrits

You can use the specific parameters for this writer to do that:

  • filecopy_source_dataset
    • This is the source path
  • filecopy_dest_filename
    • This is the new name, in your case "Final.csv"

Set Dataset to C:\\ and Subfolder name to Temp and you are good to go.

 

Also see the documentation. This is one of the not so intuitive writers in my opinion.

 

As an alternative you can use a SystemCaller with dos commandline like copy and xcopy.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+60
  • 2938 replies
  • Best Answer
  • September 18, 2023

You can use the specific parameters for this writer to do that:

  • filecopy_source_dataset
    • This is the source path
  • filecopy_dest_filename
    • This is the new name, in your case "Final.csv"

Set Dataset to C:\\ and Subfolder name to Temp and you are good to go.

 

Also see the documentation. This is one of the not so intuitive writers in my opinion.

 

As an alternative you can use a SystemCaller with dos commandline like copy and xcopy.


garbadek
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • 8 replies
  • September 18, 2023

You can use the specific parameters for this writer to do that:

  • filecopy_source_dataset
    • This is the source path
  • filecopy_dest_filename
    • This is the new name, in your case "Final.csv"

Set Dataset to C:\\ and Subfolder name to Temp and you are good to go.

 

Also see the documentation. This is one of the not so intuitive writers in my opinion.

 

As an alternative you can use a SystemCaller with dos commandline like copy and xcopy.

Thank you very much for your help and quick response and I'm sorry to be such a newbee, but I don't know exactly where I should enter these values in the writer.... If I start from the "Add Writer" dialog below, how do I set "filecopy_source_dataset" and "filecopy_dest_filename"? For example is "Dataset" "filecopy_dest_filename"? Where to I enter my dynamic attribute value with the source path and filename?image.png Thank you again?


garbadek
Contributor
Forum|alt.badge.img
  • Author
  • Contributor
  • 8 replies
  • September 18, 2023

I would still love to know how the file copy writer works (will probably need this down the road for sure), but I tried SystemCaller and got that to work in about 30 seconds. Thank you so much!.... my initial plan "B" was going to be PythonCaller, but since all my data is in Windows a quick dos copy command does the trick.