Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8243987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T21:41:44+00:00 2026-06-07T21:41:44+00:00

Have the following script. <?php if ($handle = opendir(‘files/’)) { while (false !== ($fileName

  • 0

Have the following script.

<?php

if ($handle = opendir('files/')) {
    while (false !== ($fileName = readdir($handle))) {
        $newName = str_replace("SKU#","",$fileName);
        rename(fileName, $newName);
    }
    closedir($handle); } ?>

my script is in the root directory of iss.

inetpub/wwwroot

And I am trying to as a result access the folder files/, which is one level up to wwwroot. Where contains one image called:

"WV1716BNSKU#.zoom.1"

I am using a windows OS, any idea why this is not working, code looks file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T21:41:46+00:00Added an answer on June 7, 2026 at 9:41 pm

    What error do you get? Make sure PHP is setup to display all errors.

    Your script will also have to be in the same folder as your files you want to rename as all your paths are relative.

    Try this:

    if ($handle = opendir('./')){
    
        while (false !== ($fileName = readdir($handle))){
            $newName = str_replace("SKU#", "", $fileName);
            rename($fileName, $newName);
        }
    
        closedir($handle);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following PHP script which reads from two CSV files, At the
I have the following script validation.php <?php if(!isset($_SESSION['userId'])){ session_destroy(); header('Location: home.php'); exit; } ?>
I have the following PHP script: <?php $fortune = `fortune`; echo $fortune; ?> but
I have the following code validation php script: if(empty($_POST['captcha_code'])) { $error = 1; $code[3]
I have the following jqGrid script: jQuery(#editgrid).jqGrid({ url: editing.php?q=1, datatype: xml, // ... Where
i have the following simple script <input class=input type=text name=password style=color: #797272; value= <?php
I have the following situation. I have a PHP script that imports a CSV
I have a PHP script that does the following: Uses file_get_contents() to get content
I am using the following script http://stuporglue.org/recieve-e-mail-and-save-attachments-with-a-php-script/ to handle my emails that get sent
Supposing I have the following script <div id=something> <?php // execute a loop ?>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.