Copying File Using PHP

Completed Posted Jan 6, 2006 Paid on delivery
Completed Paid on delivery

Hi there

This should be a very simple project for someone who knows what they are doing with PHP scripts.

I would like a simple PHP script that sorts through the file names in a particular directory on my web-server and copies the most recent file (based on it's name) to a directory higher up the structure. The file names in the directory are all in the form:

[login to view URL]

[login to view URL]

[login to view URL]

..etc

...and are mysqldumps of a mySQL database in ASCII text.

The PHP script should have the directory in which the files are stored and the directory to which the file will be copied, coded as variables at the top of the script - as this script will be used to perform a similar task on more than one site. The script should not require any user input, as it will eventually run as a Cron task on a daily basis.

Warmest Regards

Paul

## Deliverables

Hi there

To give a bit of background: I have a large mySQL database that is backed up every day at varying times and is given a file name according to the date and time it was created.

These daily files are large (circa 400Mb) and unless I regularly delete old files, they accumulate over time and send me over the bandwidth I am allowed for my tape-based server backups - and then I get charged extra. So I am planning to exclude the directory where all the files are stored from my tape-backups and copy the most recent file higher up the directory structure (this is where you come in) so I always have a tape backup of the most recent file.

So, I would like a very simple PHP script that sorts through the file names in a particular directory on my web-server and copies the one most recent file (based on it's name) to a directory higher up the structure and gives the file a new file name. The relevant file names in the directory are all in the exact form:

[login to view URL]

[login to view URL]

[login to view URL]

..etc

i.e.:

[login to view URL]

MMM are months of the year and will all be 3 characters, i.e.: Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Nov, Dec.

All files are mysqldumps of the mySQL database in ASCII text. It is possible there may be other files in the directory that are not named in this format. These files should be ignored.

The PHP script should have the directory in which the files are stored, the directory to which the file will be copied and the new file name, coded as variables at the top of the script - as this script will be copied and edited to perform a similar task on more than one site. The new file name will usually already exist in the directory to which it is being copied and so it should overwrite the existing file.

The script should not require any user input, as it will eventually run as a Cron task on a daily basis.

It is important that the most recent file is found using the file name, rather than the datestamp on the file itself.

For compatibility: the server is running PHP v4.3.2-26, however access to this server for testing will not be available.

Warmest Regards

Paul

## Platform

PHP v4.3.2-26 compatible

Engineering Linux MySQL PHP Software Architecture Software Testing

Project ID: #3195573

About the project

37 proposals Remote project Active Jan 9, 2006

Awarded to:

VSquash

See private message.

$29.75 USD in 5 days
(225 Reviews)
7.3

37 freelancers are bidding on average $33 for this job

progwriter

See private message.

$80.75 USD in 5 days
(620 Reviews)
7.7
javaoraclepro

See private message.

$59.5 USD in 5 days
(167 Reviews)
7.5
zeurois

See private message.

$68 USD in 5 days
(57 Reviews)
7.2
atandrau

See private message.

$17 USD in 5 days
(99 Reviews)
6.5
corecpp

See private message.

$25.5 USD in 5 days
(89 Reviews)
6.3
emberke

See private message.

$25.5 USD in 5 days
(132 Reviews)
6.2
zubairuddin

See private message.

$25.5 USD in 5 days
(71 Reviews)
6.5
silver82

See private message.

$29.75 USD in 5 days
(159 Reviews)
6.2
codersarge

See private message.

$42.5 USD in 5 days
(38 Reviews)
5.8
redcom

See private message.

$28.9 USD in 5 days
(167 Reviews)
5.4
synbiant

See private message.

$42.5 USD in 5 days
(31 Reviews)
5.0
mesh2005vw

See private message.

$4.25 USD in 5 days
(107 Reviews)
5.1
davincisoftvw

See private message.

$21.25 USD in 5 days
(45 Reviews)
4.6
normannormal

See private message.

$4.25 USD in 5 days
(75 Reviews)
5.0
CodingCops

See private message.

$25.5 USD in 5 days
(47 Reviews)
4.6
setjmp

See private message.

$21.25 USD in 5 days
(58 Reviews)
5.1
resolutionsvw

See private message.

$17 USD in 5 days
(18 Reviews)
3.9
josbosmans

See private message.

$15.3 USD in 5 days
(14 Reviews)
3.6
vw1614561vw

See private message.

$29.75 USD in 5 days
(35 Reviews)
3.6
scotsteam

See private message.

$25.5 USD in 5 days
(9 Reviews)
3.3