Skip to main content
Solved

Copy random .csv file to one name.

  • September 18, 2023
  • 3 replies
  • 35 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.

View original
Did this help you find an answer to your question?

3 replies

nielsgerrits
VIP
Forum|alt.badge.img+54
  • 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
  • September 18, 2023
nielsgerrits wrote:

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
  • 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.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings