Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpZ6L-0008S4-7V for pgsql-general@arkaria.postgresql.org; Tue, 14 Aug 2018 13:11:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpZ6J-0007O5-KU for pgsql-general@arkaria.postgresql.org; Tue, 14 Aug 2018 13:11:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fpZ6J-0007Ny-Ci for pgsql-general@lists.postgresql.org; Tue, 14 Aug 2018 13:11:07 +0000 Received: from n3.nabble.com ([162.255.23.22]) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fpZ67-0004s9-UD for pgsql-general@postgresql.org; Tue, 14 Aug 2018 13:11:06 +0000 Received: from n3.nabble.com (localhost [127.0.0.1]) by n3.nabble.com (Postfix) with ESMTP id 92AE6E8C8ED2 for ; Tue, 14 Aug 2018 06:10:53 -0700 (MST) Date: Tue, 14 Aug 2018 06:10:53 -0700 (MST) From: pavan95 To: pgsql-general@postgresql.org Message-ID: <1534252253597-0.post@n3.nabble.com> Subject: Re: Copying data from a CSV file into a table dynamically MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi all, I am well versed with the COPY command for copying the contents of a csv file into a table. I am used to the below mentioned command: * COPY postgres_log1 FROM '/tmp/abc/xyz/postgresql-2018-08-14_000000.csv' WITH csv;* But in the location "/tmp/abc/xyz/" daily a file(with header postgresql-2018-08-14_000000.csv) will be generated. So how can I automate this task instead of manually specifying the file name, it has to look for the filename with current_date at the time of copying into table. How can I achieve this? Any suggestions or modifications are most welcome. Regards, Pavan -- Sent from: http://www.postgresql-archive.org/PostgreSQL-general-f1843780.html