Copying File Using PHP

Ukończone Opublikowano Jan 6, 2006 Płatność przy odbiorze
Ukończone Płatność przy odbiorze

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

Inżynieria Linux MySQL PHP Architektura oprogramowania Testowanie oprogramowania

Numer ID Projektu: #3195573

O projekcie

38 ofert Zdalny projekt Aktywny Jan 9, 2006

Przyznany użytkownikowi:

VSquash

See private message.

$29.75 USD w ciągu 5 dni
(225 ocen)
7.3

38 freelancerów złożyło ofertę za $33 w tym projekcie

progwriter

See private message.

$80.75 USD w ciągu 5 dni
(620 Oceny)
7.7
javaoraclepro

See private message.

$59.5 USD w ciągu 5 dni
(167 Oceny)
7.5
zeurois

See private message.

$68 USD w ciągu 5 dni
(57 Oceny)
7.2
atandrau

See private message.

$17 USD w ciągu 5 dni
(99 Oceny)
6.5
corecpp

See private message.

$25.5 USD w ciągu 5 dni
(89 Oceny)
6.3
emberke

See private message.

$25.5 USD w ciągu 5 dni
(132 Oceny)
6.2
zubairuddin

See private message.

$25.5 USD w ciągu 5 dni
(71 Oceny)
6.5
silver82

See private message.

$29.75 USD w ciągu 5 dni
(159 Oceny)
6.2
codersarge

See private message.

$42.5 USD w ciągu 5 dni
(38 Oceny)
5.8
synbiant

See private message.

$42.5 USD w ciągu 5 dni
(31 Oceny)
5.0
mesh2005vw

See private message.

$4.25 USD w ciągu 5 dni
(107 Oceny)
5.1
redcom

See private message.

$28.9 USD w ciągu 5 dni
(167 Oceny)
5.4
davincisoftvw

See private message.

$21.25 USD w ciągu 5 dni
(45 Oceny)
4.6
normannormal

See private message.

$4.25 USD w ciągu 5 dni
(75 Oceny)
5.0
CodingCops

See private message.

$25.5 USD w ciągu 5 dni
(47 Oceny)
4.6
setjmp

See private message.

$21.25 USD w ciągu 5 dni
(58 Oceny)
5.1
resolutionsvw

See private message.

$17 USD w ciągu 5 dni
(18 Oceny)
3.9
goodspec

See private message.

$50.15 USD w ciągu 5 dni
(6 Oceny)
3.6
josbosmans

See private message.

$15.3 USD w ciągu 5 dni
(14 Oceny)
3.6
vw1614561vw

See private message.

$29.75 USD w ciągu 5 dni
(35 Oceny)
3.6