rename

php rename failure

邮差的信 提交于 2019-12-25 08:22:00
问题 I have some problems with PHP Rename . $rm = rename($path.$package."/",$path.$get["theme_name"]."/"); if ($rm == FALSE) { return "RENAME_FAILURE"; } here i got a error A PHP Error was encountered Severity: Warning Message: rename(/home/pr/public_html/developer/public_themes/arkGT/,/home/pr/public_html/developer/public_themes/new_roller/) [function.rename]: Directory not empty Filename: models/pagemodel.php Line Number: 218 i checked the cpanel,everything is ok,the folder is renamed to new

.bat rename files in folders/sub-folders to specific name

試著忘記壹切 提交于 2019-12-25 03:24:09
问题 I need a .bat file that can go into a folder with many sub-folders and rename every .iso file to "Game.iso". I had a way to do it but I cant seem to find it anymore and I lost the damn file :(. Example: -Main DIR --A ---file name.iso --B ---file name.iso --Z ---file name.iso What I want to be like when I run .bat file: -Main DIR --A ---game.iso --B ---game.iso --Z ---game.iso That is really my main concern. That would be super amazing and I would appreciate it tremendously. 回答1: Simple: for

Perl: Bad Symbol for dirhandle

自闭症网瘾萝莉.ら 提交于 2019-12-25 02:37:24
问题 This is my code: opendir(DIR, $directoryPath) or die "Cant open $directoryPath$!"; my @files = readdir(DIR); #Array of file names closedir (DIR) or die "Cant close $directoryPath$!"; I'm using @files to create an array of the file names within the directory for renaming later in the program. The problem is: I am getting the error "Bad Symbol for dirhandle" at the closedir line. If I don't closedir to avoid this, I don't have permission to change file names (I'm using Windows). I tried an

Download and rename file from Server using php script

為{幸葍}努か 提交于 2019-12-25 02:21:25
问题 I am storing all my files like "8asd98asd9as7d98asd9.file" and rerieve the "real" filename from a mysql-database: id (INT) AI PK, pathOnServer TEXT NOT NULL, realFilename VARCHAR(200) NOT NULL. I need a script which allows me to access the files like "www.website.com/getFile?id=2" which downloads the file and renames it to "realFilename". How can this be done? 回答1: I do believe this code will do a trick you look for <?php if(!is_numeric($_GET['id'])) { // We validate parameter echo 'Wrong

Rename filename using another files name from the same folder

寵の児 提交于 2019-12-25 02:01:31
问题 I currently have a windows folder with only two files in it: vacation.jpg and summer.avi What I want to to is rename summer.avi in vacation.avi by using the text that is before the .jpg extension. So for example if I have another folder with christmas.jpg and summer.avi the .avi file would be renamed into christmas.avi. Any help would be much appreciated! 回答1: You can use the ~n parameter extension to grab just the filename without the extension. The script needs to be in the same directory

I'm trying to remove “ .RETCH ” from my file names with my batch script

别来无恙 提交于 2019-12-25 01:38:38
问题 I'm simply trying to have my existing script remove " .RETCH " from the file name. ex. " B00TI8DTJY.RETCH.PT01.jpg --> B00TI8DTJY.PT01.jpg " I know how to remove a certain amount of characters or add something to the file name but can't figure out how to Only remove the .RETCH part. Thanks. 回答1: setlocal enabledelayedexpansion for /f %%a in ('dir *RETCH* /b') do ( set "name=%%a"&set "name=!name:.RETCH=!" ren "%%a" "!name!" ) Just run this on the same directory as your files. If it's needed to

Equivalent of MSVC++ _wrename in linux g++?

拟墨画扇 提交于 2019-12-25 01:38:21
问题 Does anyone know if an equivalent of MSVC _wrename exist in linux g++ ? (equivalent of cstdio file rename function using const wchar_t* instead of const char* as parameter type for unicode use) Thanks ! 回答1: The point is that most filesystems other than NTFS store their filenames in byte -strings. There is usually no explicit notion of encoding, but the filenames have to be strings of non-zero bytes terminated by a zero. So on all such systems, filesystem functions just take char* arguments

Copy files renaming if already exists PowerShell

橙三吉。 提交于 2019-12-25 00:43:12
问题 This script works to rename files while copying them if they are duplicates. I need to rename the current destination file first then copy the source file as is. Any ideas? function Copy-FilesWithVersioning{ Param( [string]$source, [string]$destination ) Get-ChildItem -Path $source -File ForEach-Object { $destinationFile = Join-Path $destination $file.Name if ($f = Get-Item $destinationFile -EA 0) { # loop for number goes here $i = 1 $newname = $f.Name -replace $f.BaseName, "$($f.BaseName)_$I

PowerShell Regex Bulk Replace Filenames [duplicate]

ε祈祈猫儿з 提交于 2019-12-24 20:51:22
问题 This question already has answers here : PowerShell: Quoting -replace & variables (4 answers) Closed last year . I am trying to replace filenames in a given folder, but using regular expressions as a filter and in the new filenames, in PowerShell. For example, a file name "CEX-13" should be renamed to "C-0013"; "CEX-14" should change to "C-0014", etc. I have this, but I get an error that I cannot create a file that already exists. My current code is: foreach ($file in get-childitem | where

batch code to chnage folders name after read text files

让人想犯罪 __ 提交于 2019-12-24 20:19:57
问题 Someone great in this site give me this code at batch change folder name by read line from text file @echo off pushd "your root location" for /f "tokens=1* delims=:" %%A in ( 'findstr /srbc:"SMTP_Email_Address *type=SZ *[^ ][^ ]*@[^ ][^ ]*\.[^ ][^ ]* *SMTP_Email_Address" filel.txt^|sort /r' ) do if exist "%%A" for %%F in ("%%A\..") do ( for /f "tokens=3" %%N in ("%%B") do ren "%%~fF" "%%N" ) popd the code find this code perfectly SMTP_Email_Address type=SZ name@company.com SMTP_Email_Address