Home Backend Development PHP Tutorial php中批量修改文件后缀名的函数代码_PHP

php中批量修改文件后缀名的函数代码_PHP

Jun 01, 2016 pm 12:14 PM
suffix Batch Edit

复制代码 代码如下:
function foreachDir($path){
$handle=opendir($path);
if($handle){
while (false !== ($file = readdir($handle))) {
if($file!="." && $file!='..'){
if(is_dir($path.$file)){
echo $path.$file."
";
foreachDir($path.$file);
}else{
echo "--".$path."/".$file."
";
$ext = strripos($file,'.');
$aaa = substr($file,0,$ext);
rename($path.'/'.$file,$path.'/'.$aaa.'.JPG');
// die();
}
}
}
return false;
}
}
foreachDir('D:\xampp\htdocs\TNF2');
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Win11 file attribute setting tutorial: How to display suffix name? Win11 file attribute setting tutorial: How to display suffix name? Mar 08, 2024 pm 06:18 PM

Win11 file attribute setting tutorial: How to display suffix name? As one of the most popular operating systems, Windows operating system has always been loved and used by users. In the latest version of Windows 11, some file attribute settings are different from previous versions, including how to display file extensions. This article will introduce how to set the display of file suffix names in Windows 11. In the Windows operating system, files are hidden by default.

How to change file extension in win11 How to change file extension in win11 Jun 29, 2023 pm 12:22 PM

How to change the file extension in win11? The win11 system occupies half of the computer system usage world. Many friends are using this version of the system to operate. This version also provides users with many rich system tools. However, many friends are always unable to use this version of the system. You know how to change the suffix name of a file, but many friends don’t know how to do it in detail. The editor has compiled the tips for changing the file suffix name in win11. If you are interested, follow the editor and read on! Tips for changing file extensions in win11 1. First we open "This PC" 2. Then click "View" in the upper bar 3. Then select "Show" in the drop-down menu and then check "File extension" 4. After the modification is completed, We find what we want to modify

How to use regular expressions to batch modify PHP code to meet the latest code specifications? How to use regular expressions to batch modify PHP code to meet the latest code specifications? Sep 05, 2023 pm 03:57 PM

How to use regular expressions to batch modify PHP code to meet the latest code specifications? Introduction: As time goes by and technology develops, code specifications are constantly updated and improved. During the development process, we often need to modify old code to comply with the latest code specifications. However, manual modification can be a tedious and time-consuming task. In this case, regular expressions can be a powerful tool. Using regular expressions, we can modify the code in batches and automatically meet the latest code specifications. 1. Preparation: before using

How to batch modify fonts in PPT? Quickly unify PPT fonts How to batch modify fonts in PPT? Quickly unify PPT fonts Mar 14, 2024 am 11:20 AM

​When editing a PPT presentation, how to uniformly change the fonts? When presenting, using a font can make the presentation look more concise and beautiful, so what I want to share with you below is the PPT layout technique: quickly unify the PPT font. Interested users come and take a look. 1. Unify the font through the master If the current PPT is created using the theme style, then we set it in the slide template mode to unify the font. Method: Select [View]-[Master View]-[Slide Master], and then click the first master slide in the space on the left side of the interface. At this time, all title and text fonts of the PPT can be modified in the pop-up "Font" toolbar. Tip: in &

The tacit cooperation between Vue and Excel: how to realize batch modification and export of data The tacit cooperation between Vue and Excel: how to realize batch modification and export of data Jul 21, 2023 pm 01:40 PM

The tacit cooperation between Vue and Excel: How to realize batch modification and export of data In terms of data management and processing, Excel has always been a commonly used tool. With the development of front-end technology, Vue, as a popular JavaScript framework, also has excellent performance in data display and processing. This article will introduce how to realize batch modification and export of data through the combination of Vue and Excel. The technology stack involved is as follows: Vue.js: a front-end JavaScript framework for building

jQuery tutorial: How to batch modify the values ​​of all a tags jQuery tutorial: How to batch modify the values ​​of all a tags Feb 28, 2024 pm 10:06 PM

Title: jQuery Tutorial: How to batch modify the values ​​of all a tags, specific code examples are needed. In web development, we often encounter situations where we need to batch modify the text values ​​of all links on the page. This can be easily accomplished using jQuery, saving time and effort on manual modifications. This article will introduce how to use jQuery to batch modify the text value of all a tags, and attach specific code examples. First, we need to introduce the jQuery library into the page, either through a CDN link or by linking the jQuery library

How to open the hidden suffix in win10 How to open the hidden suffix in win10 Detailed introduction How to open the hidden suffix in win10 How to open the hidden suffix in win10 Detailed introduction Jul 11, 2023 pm 03:37 PM

Win10 suffix is ​​a very common element. The suffix can indicate the format of the current file, and each file can only be identified by matching the format. Some customers need to check the suffix of the current file but don't know how to open it. So how to open it if the suffix is ​​hidden in win10. The following will provide you with relevant content on how to open the file if the suffix is ​​hidden in win10. How to open the file extension in Win10 system software if the file extension is hidden in Win10? You can select the file extension to open in the File Task Manager. 1. First open [This PC] on your computer. 2. Click the [Query] option in the resource optimization configuration toolbar. 3. Then in the world

How to modify the title format in batches in Word How to modify the title format in batches in Word Feb 29, 2024 pm 02:40 PM

When writing a Word document, we may need to use multiple headings to organize and display the topic content. Ensuring that all headings are formatted uniformly provides the document with clear visual organization and a professional look. However, manually formatting headings one by one can be time-consuming, especially if you are working on a document with a large number of headings. Word has a powerful function that allows you to batch modify the format of all titles of the same level. From font size to color and style, all elements can be set uniformly. Use Word's styles feature to easily create a set of heading formats and apply them to the entire document. This approach not only saves time but also ensures consistency in document formatting. This article will introduce how to batch modify Wor

See all articles