script to display list of files with a particular string matching,plus a few things

Thread Solved

Join Date: Jan 2009
Posts: 33
Reputation: arvindikchari is an unknown quantity at this point 
Solved Threads: 0
arvindikchari arvindikchari is offline Offline
Light Poster

script to display list of files with a particular string matching,plus a few things

 
0
  #1
Jun 6th, 2009
Hello,

I want a simple Php script which does the following:

(a) List all file names alphabetically such that the LAST 3 letters of the file name match with one of a few strings entered by the user at runtime
For eg, two strings PDF and TXT are specified by user at runtime, and in the directory there are 4 files: abcpdf.zip, abctxt.zip, xyzpdf.zip and xyztxt.zip
Then the script should create the following records in a mysql database:
(1) From the files abcpdf.zip and abctxt.zip, the script should extract the string 'abc' and create a record in table 'A' with the string abc as one of the fields
(2) In another table 'B' there should be one record for abctxt.zip and abcpdf.zip
This should also be done for xyzpdf.zip and xyztxt.zip, and for all files which have last 3 letters as 'pdf' or 'txt'.

At run time, upto 6 different strings (like 'pdf' or 'txt' should be specified by the user)

FOr the mysql records kindly create a generic statement of inserting data into a table, i will update that statement with the actual data required

Thanks in advance,
Arvind
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 340
Reputation: Josh Connerty is an unknown quantity at this point 
Solved Threads: 26
Josh Connerty's Avatar
Josh Connerty Josh Connerty is offline Offline
Posting Whiz

Re: script to display list of files with a particular string matching,plus a few things

 
0
  #2
Jun 6th, 2009
Does pdf and txt have to be as a string or jumbled up chars?
Posts should be like mini-skirts, long enough to cover enough, but not too long that you cover too much.

My Liveperson: http://liveperson.com/josh-connerty/
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,064
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 135
ardav's Avatar
ardav ardav is online now Online
Veteran Poster

Re: script to display list of files with a particular string matching,plus a few things

 
0
  #3
Jun 6th, 2009
What have you got so far? Put up your code so we can have a look and point you in the right direction.
Happy Humbugging Christmas
Reply With Quote Quick reply to this message  
Join Date: Jan 2009
Posts: 33
Reputation: arvindikchari is an unknown quantity at this point 
Solved Threads: 0
arvindikchari arvindikchari is offline Offline
Light Poster

Re: script to display list of files with a particular string matching,plus a few things

 
0
  #4
Jun 6th, 2009
Hello

Ardav, I havent coded anything as i dont know how to code in php

Josh, PDF and txt has to be a string

Regards
Arvind
Reply With Quote Quick reply to this message  
Join Date: Apr 2009
Posts: 340
Reputation: Josh Connerty is an unknown quantity at this point 
Solved Threads: 26
Josh Connerty's Avatar
Josh Connerty Josh Connerty is offline Offline
Posting Whiz

Re: script to display list of files with a particular string matching,plus a few things

 
0
  #5
Jun 7th, 2009
Well good thats easier for you then.

You need to look into PHP scandir() and PHP explode() then take a look at the mysql_() functions.

This will basicly tell you what you need to know.
Posts should be like mini-skirts, long enough to cover enough, but not too long that you cover too much.

My Liveperson: http://liveperson.com/josh-connerty/
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,064
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 135
ardav's Avatar
ardav ardav is online now Online
Veteran Poster

Re: script to display list of files with a particular string matching,plus a few things

 
0
  #6
Jun 7th, 2009
@Arvin

Come on fella, you gotta do some work yourself. This ain't no charity. Help fair enough, but don't expect people to do all the work for you.
Happy Humbugging Christmas
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC