<?php
mkdir(“/path/to/my/dir”, 0777);
?>
http://sg.php.net/manual/en/function.mkdir.php
<?php
mkdir(“/path/to/my/dir”, 0777);
?>
http://sg.php.net/manual/en/function.mkdir.php
<?php
/**
* Delete a file, or a folder and its contents
*
* @author Aidan Lister <aidan@php.net>
* @version 1.0.2
* @param string $dirname Directory to delete
* @return bool Returns TRUE on success, FALSE on failure
*/
function rmdirr($dirname)
{
// Sanity check
if (!file_exists($dirname)) {
return false;
}
// Simple delete for a file
if (is_file($dirname)) {
return unlink($dirname);
}
// Loop through the folder
$dir = dir($dirname);
while (false !== $entry = $dir->read()) {
// Skip pointers
if ($entry == ‘.’ || $entry == ‘..’) {
continue;
}
// Recurse
rmdirr(“$dirname/$entry”);
}
// Clean up
$dir->close();
return rmdir($dirname);
}
?>
http://aidan.dotgeek.org/lib/?file=function.rmdirr.php
The following batch script will rename the files from the current directory to their creation date and time, with the format YYMMDD-HHMM.extention (the extention will be mantained). The script not only on WinXP, but also in Win95Cmd.EXE, which is somekind of Win2000’s command interpreter emulator.
===== BATCH SCRIPT BEGIN =====
@echo off
if “%OS%”==”Windows_NT” goto OSOK
echo This program must be run in a NT system.
goto eof
:OSOK
if “%1″==”GoTo” goto %2
%comspec% /v /c %0 GoTo start
goto eof
:start
for %%? in (*.*) do (
for /F “tokens=1-6 delims=/-: ” %%A in (“%%~t?”) do (
set MM=%%A
set DD=%%B
set YYYY=%%C
set HH=%%D
set MI=%%E
set AP=%%F
if “!AP!”==”PM” set /A HH += 12
set YY=!YYYY:~-2!
REN %%~s? !YY!!MM!!DD!-!HH!!MI!%%~x?
)
)
:eof
===== BATCH SCRIPT END =====
Another script, which should work on Windows 2000.
===== BATCH SCRIPT BEGIN =====
@echo off
if “%1″==”GoTo” goto %2
ver |FIND “Microsoft Windows 2000″ > nul
if not errorlevel=1 goto OSOK
echo This program must be run in Microsoft Windows 2000.
goto eof
:OSOK
%comspec% /v:on /c %0 GoTo start
goto eof
:start
for %%? in (*.*) do (
for /F “tokens=1-6 delims=/-: ” %%A in (“%%~t?”) do (
set MM=%%A
set DD=%%B
set YY=%%C
set HH=%%D
set MI=%%E
if “!MI:~-1!”==”p” set /A HH += 12
set MI=!MI:~0,-1!
:: To activate the script, remove “echo.{demo}” from next line
echo.{demo}REN %%~s? !YY!!MM!!DD!-!HH!!MI!%%~x?
)
)
:eof
===== BATCH SCRIPT END =====