will this script copy only certain files?
i want to copy all the files [but none of the folders] from one folder to another.
To copy only the files and not the folders will this work: Code:
<?php |
The code looks like PHP, but if you had omitted the comment, it would be Perl... Please, mention the programming language you are using, so we do not have to guess. (Including the starters <?php and ?> would also help.)
Solution for PHP: PHP Code:
Hope I could help, mschutte |
thanks alot, it seems to work. Just one problem.
Code:
define('TARGETDIR', '/home/xxx/mainwebsite/new/''); Warning: copy(/home/abc/dep/*"misc_filename".php): failed to open stream: No such file or directory in /var/www/html/"scriptname".php): on line 101 line 101 : Code:
copy($dep, TARGETDIR . basename($dep)); |
Well, it doesn't match the error message, but does the target directory exist? Oh, and does the httpd user have reading permissions to the source and target directories? The httpd user is commonly 'wwwrun', 'apache', ... depending on the distro.
It does work at my host. |
the target is made prior in the script, other folders are linked to the target folder, then i place your copy files script to copy the files.
so in theory it should work, but i cant get it for some reason. Code:
// Define directory |
It might be a typo, but you have to enclose the path in TARGETDIR in double quotes "" to expand {$username} -- in single quotes, {$username} is not substituted, but included verbatim.
|
All times are GMT -5. The time now is 09:58 PM. |