dsaba Posted January 27, 2008 Share Posted January 27, 2008 I'm on Windows XP Home I'm trying to backup my entire contents of one folder with many subfolders into another folder, the problem I get is that random files in these files i'm trying to copy over have access denied on them. In other words when I'm doing a copy operation, it breaks the entire operation to give me an error msg saying how 1 file is access denied and cannot be copied to the destination. This stops the whole copy operation, does not clue me where it stopped, and leads me to go digging through all the subfolders to find the location of where it stopped and try to select all the remainder of the files except for this problem 1 to continue the copy operation. If this happens multiple times, you can imagine the anguish. I've tried changing the read only attributes all at once for all the file i would like to copy so I won't run into this error, but some files won't let me change their attributes. All I want to do is copy a giant number of files to another destination, without having to stop the operation every time it encounters a file that cannot be copied. Isn't there a way to do this and simply skip over the ones it doesn't have access to copy? Frustrated... Thank you Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/ Share on other sites More sharing options...
Daniel0 Posted January 27, 2008 Share Posted January 27, 2008 is_readable() Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-450605 Share on other sites More sharing options...
dsaba Posted January 27, 2008 Author Share Posted January 27, 2008 Do you really believe that this statement will help me Daniel? Because it doesn't, do not reply under the impression that what you say will help, because I'm telling you now it didn't. Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-450619 Share on other sites More sharing options...
Daniel0 Posted January 27, 2008 Share Posted January 27, 2008 Then you did it wrong. But seeing as you're too lazy to read the manual, to state how what I wrote didn't help you, provide any code, here is a function that will copy a folder. I didn't test it. <?php function move_folder($folder, $new_location) { $content = scandir($folder); if(!is_dir($new_location)) { mkdir($new_location); } foreach($content as $item) { $old = $folder . DIRECTORY_SEPARATOR . $item; if($item == '.' || $item == '..' || !is_readable($old)) continue; if(is_dir($old)) { move_folder($old, $new_location . DIRECTORY_SEPARATOR . $item); } else { copy($old, $new_location . DIRECTORY_SEPARATOR . $item); } } } ?> Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-450630 Share on other sites More sharing options...
dsaba Posted January 29, 2008 Author Share Posted January 29, 2008 I'm not talking about php, I'm talking about copy operations within windows XP, not doing anything with code. Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-451962 Share on other sites More sharing options...
neylitalo Posted January 29, 2008 Share Posted January 29, 2008 You've tried copying files as administrator, or an equally privileged user? Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-451987 Share on other sites More sharing options...
Daniel0 Posted January 29, 2008 Share Posted January 29, 2008 I'm not talking about php, I'm talking about copy operations within windows XP, not doing anything with code. Why didn't you just say that instead of saying "it didn't help me" four times within two sentences? You can still use the function though, make a script and run it from the command line. PHP is not just for websites. There is more than one way to do things. Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-452086 Share on other sites More sharing options...
dsaba Posted January 29, 2008 Author Share Posted January 29, 2008 You've tried copying files as administrator, or an equally privileged user? Yes I have on windows XP. Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-452282 Share on other sites More sharing options...
NikkiLoveGod Posted January 30, 2008 Share Posted January 30, 2008 Why dont you try moving the files within command prompt as an administrative? I think you can put an tag there that says ignore errors or something. Try the help! Atleast it should give you an prompt that says which file is denied. Not sure though, worth a try. ( atleast it works in linux ) -NikkiLoveGod Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-453203 Share on other sites More sharing options...
Stooney Posted January 31, 2008 Share Posted January 31, 2008 In the command prompt xcopy "c:\source" "c:\destination" /C /E /Y That should copy source to destination including all sub directories, continuing past errors, and auto confirming to write over existing files. Took 30 seconds for google to teach me. http://www.computerhope.com/xcopyhlp.htm Quote Link to comment https://forums.phpfreaks.com/topic/88075-skipping-automatically-over-access-denied-files-in-copying-mass-files/#findComment-454034 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.