Another update from ingydotnet^djgoku

This commit is contained in:
Ingy döt Net 2015-11-18 06:14:39 +00:00
parent 91df62d461
commit 948b86eafa
7604 changed files with 108452 additions and 22726 deletions

View file

@ -0,0 +1,30 @@
@echo off
if "%~1"=="" exit /b 3
set "samp_path=%~1"
set "tst_var="
%== Store the current directory of the CMD ==%
for /f %%T in ('cd') do set curr_dir=%%T
%== Go to the samp_path ==%
cd %samp_path% 2>nul ||goto :folder_not_found
%== The current directory is now samp_path ==%
%== Scan what is inside samp_path ==%
for /f "usebackq delims=" %%D in (
`dir /b 2^>nul ^& dir /b /ah 2^>nul`
) do set "tst_var=1"
if "%tst_var%"=="1" (
echo "%samp_path%" is NOT empty.
cd %curr_dir%
exit /b 1
) else (
echo "%samp_path%" is empty.
cd %curr_dir%
exit /b 0
)
:folder_not_found
echo Folder not found.
exit /b 2

View file

@ -0,0 +1,16 @@
#include <iostream>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
int main(int argc, char *argv[])
{
for (int i = 1; i < argc; ++i) {
path p(argv[i]);
if (exists(p) && is_directory(p))
std::cout << "'" << argv[i] << "' is" << (!is_empty(p) ? " not" : "") << " empty\n";
else
std::cout << "dir '" << argv[i] << "' could not be found\n";
}
}

View file

@ -0,0 +1,2 @@
path = hd(System.argv)
IO.puts File.dir?(path) and Enum.empty?( File.ls!(path) )

View file

@ -0,0 +1,3 @@
(define (empty-dir? path-to-check)
(empty? (clean (lambda (x) (or (= "." x) (= ".." x))) (directory path-to-check)))
)

View file

@ -0,0 +1,6 @@
$path = "C:\Users"
if((Dir $path).Count -eq 0) {
"$path is empty"
} else {
"$path is not empty"
}

View file

@ -0,0 +1,12 @@
Function IsDirEmpty(path)
IsDirEmpty = False
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(path)
If objFolder.Files.Count = 0 And objFolder.SubFolders.Count = 0 Then
IsDirEmpty = True
End If
End Function
'Test
WScript.StdOut.WriteLine IsDirEmpty("C:\Temp")
WScript.StdOut.WriteLine IsDirEmpty("C:\Temp\test")