Skip site navigation (1) Skip section navigation (2)

Re: How to insert data from a text file

From: Michael Wood <esiotrot(at)gmail(dot)com>
To: damien clochard <damien(at)dalibo(dot)info>
Cc: Mike <1100100(at)gmail(dot)com>, pgsql-novice(at)postgresql(dot)org
Subject: Re: How to insert data from a text file
Date: 2009-07-20 19:27:41
Message-ID: 5a8aa6680907201227w578db654icf429a6373c9c838@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
2009/7/20 damien clochard <damien(at)dalibo(dot)info>:
> Mike a écrit :
[...]
>> I used the following command to gather all file and directory names.
>> "/abc" is the main directory on the linux samba server where all
>> company data is located:
>>
>> root(at)acme:/# ls -Ralh /abc > /home/mike/file_output.txt

If you just want the file paths, using "find" might make things easier
to deal with:

# find /abc -type f -print >/home/mike/file_output.txt

>> file_output.txt is 33 megs. and lists approximately 650,000 file names
>> and their directory paths.
>>
>> I want to pull all the file name info. and directory path info. from
>> "file_output.txt" and place each file name into a postgresql database
>> along with the related file location information.
>> The ultimate goal is to be able to make an alpha-numeric query and be
>> presented with matching file names and their location on the samba
>> server.
>>
>> How do I pull the data from "file_output.txt" and place it into the
>> postgres database?

If you use "find" as mentioned above, then you can do this to get the
file and directory information by splitting on the last "/".

-- 
Michael Wood <esiotrot(at)gmail(dot)com>

In response to

Responses

pgsql-novice by date

Next:From: Jure KobalDate: 2009-07-20 19:43:06
Subject: Re: STARTING SERIAL / BIGSERIAL FIELDS FROM 1.
Previous:From: Jure KobalDate: 2009-07-20 19:09:56
Subject: Re: STARTING SERIAL / BIGSERIAL FIELDS FROM 1.

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group