Jump to content

A script to check files in one directory and copy them to annother...


Curver

Recommended Posts

Hello everyone!

 

Im new here, but i have been doing some php coding for a while and im trying to move my skills on from basic database manipulation and design.

 

I’ve not done anything with files but i need a script to fix a problem which i have to do manually every day. Basically, i run with both a https and a http folder on the server but when users upload and change files it only does this on the https folder and not the http folder. Unfortunately, this is a encrypted third party script for an e-commerce website and therefore i can’t just change the code to work with both directories.

 

I currently just use an ftp program to download all of the images in httpsdocs/images and set it to skip if the file already exists. I then do the exact same upload command to the httpdocs/images folder. This way it only uploads the new files and doesn’t touch the old files thus saving me bandwidth and time.

 

Now i know what your going to say, turn off use separate folders in plesk which would be great if i knew which files were used in https transactions and which weren’t. That’s right, the previous webmaster is running different file sets on both directories and I want to implement this while I work through the file versions.

 

Back on to code, is there a way to do this in php? Im planning on running a cron job to execute the script which will check each file in a folder if it exists in another folder. If it doesn’t exist it copies the file to the other folder. A point in the right direction to some documentation on the code will be helpful as I’m wanting to learn.

 

Thanks,

Curver

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.