Hi,

I am trying to copy a directory from one spot on my server to another spot on my server. I have copied the directory successfully, but suppose I delete a file in the "parent" directory. I want the "child" directory to be exactly the same as the parent directory. I have thought of one way I could do it: I could simply delete the child directory and then copy the new directory all over again and that would work. Here is the problem: I could be hosting upwards of 300,000 files at roughly 30MB each. I don't want to delete and copy all of that. It would take FOREVER! So what are some suggestions that you guys (or girls) may have? It is a large project so I can't afford to do it sloppy.

Thanks,

Not sure if it's possible/works but i wonder if you can make the child directory a shortcut to the parent?

parentfolder/file1.pdf

childfolder/file1.pdf -> parentfolder/file1.pdf

or is this backup related?

Another idea could be to get a program that will sync 2 folders so they match, a quick google search brought up this Directory sync

As suggested by Biiim you could use symbolic links: http://php.net/manual/en/function.symlink.php
In linux the command is ln -s /path/to/file.ext /new/path/file.ext but you can do this to the parent directory, just like an alias and have two different directory names poiting to the same files.

Is it a requirement you do this in code? For synchronizing folders on my servers I use Beyond Compare. Works like a charm.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.