Data update
This commit is contained in:
parent
4bb20c9b71
commit
cbaf4c4b64
12390 changed files with 318560 additions and 27248 deletions
8
Task/File-size/Ada/file-size.adb
Normal file
8
Task/File-size/Ada/file-size.adb
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
with Ada.Directories; use Ada.Directories;
|
||||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Test_File_Size is
|
||||
begin
|
||||
Put_Line (File_Size'Image (Size ("input.txt")) & " bytes");
|
||||
Put_Line (File_Size'Image (Size ("/input.txt")) & " bytes");
|
||||
end Test_File_Size;
|
||||
12
Task/File-size/Batch-File/file-size-1.bat
Normal file
12
Task/File-size/Batch-File/file-size-1.bat
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
@echo off
|
||||
call :filesize input.txt
|
||||
echo Size of file input.txt: %res%
|
||||
call :filesize \input.txt
|
||||
echo Size of file \input.txt: %res%
|
||||
goto:eof
|
||||
|
||||
:filesize
|
||||
2>nul (
|
||||
for %%i in ("%~1") do set /a res=%%~zi
|
||||
) || set /a res=-1
|
||||
goto:eof
|
||||
2
Task/File-size/Batch-File/file-size-2.bat
Normal file
2
Task/File-size/Batch-File/file-size-2.bat
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
dir /a-d input.txt \input.txt
|
||||
42
Task/File-size/COBOL/file-size.cob
Normal file
42
Task/File-size/COBOL/file-size.cob
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
identification division.
|
||||
program-id. FileInfo.
|
||||
|
||||
data division.
|
||||
working-storage section.
|
||||
01 file-name pic x(256).
|
||||
01 file-size-edited pic zzz,zzz,zzz.
|
||||
01 file-details.
|
||||
05 file-size pic x(8) comp-x.
|
||||
05 file-date.
|
||||
10 file-day pic x comp-x.
|
||||
10 file-month pic x comp-x.
|
||||
10 file-year pic xx comp-x.
|
||||
05 file-time.
|
||||
10 file-hour pic x comp-x.
|
||||
10 file-minute pic x comp-x.
|
||||
10 file-second pic x comp-x.
|
||||
10 file-hundredths pic x comp-x.
|
||||
|
||||
procedure division.
|
||||
main.
|
||||
move "input.txt" to file-name
|
||||
perform file-info
|
||||
|
||||
move "\input.txt" to file-name
|
||||
perform file-info
|
||||
|
||||
stop run
|
||||
.
|
||||
|
||||
file-info.
|
||||
call "CBL_CHECK_FILE_EXIST"
|
||||
using file-name, file-details
|
||||
returning return-code
|
||||
if return-code = 0
|
||||
move file-size to file-size-edited
|
||||
display function trim(file-name) " "
|
||||
function trim(file-size-edited) " Bytes"
|
||||
else
|
||||
display function trim(file-name) " not found!"
|
||||
end-if
|
||||
.
|
||||
2
Task/File-size/Crystal/file-size.cr
Normal file
2
Task/File-size/Crystal/file-size.cr
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
size1 = File.size("input.txt")
|
||||
size2 = File.size("/input.txt")
|
||||
3
Task/File-size/Emacs-Lisp/file-size.el
Normal file
3
Task/File-size/Emacs-Lisp/file-size.el
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
(message "sizes are %s and %s"
|
||||
(nth 7 (file-attributes "input.txt"))
|
||||
(nth 7 (file-attributes "/input.txt")))
|
||||
24
Task/File-size/Euphoria/file-size.eu
Normal file
24
Task/File-size/Euphoria/file-size.eu
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
include file.e
|
||||
|
||||
function file_size(sequence file_name)
|
||||
object x
|
||||
x = dir(file_name)
|
||||
if sequence(x) and length(x) = 1 then
|
||||
return x[1][D_SIZE]
|
||||
else
|
||||
return -1 -- the file does not exist
|
||||
end if
|
||||
end function
|
||||
|
||||
procedure test(sequence file_name)
|
||||
integer size
|
||||
size = file_size(file_name)
|
||||
if size < 0 then
|
||||
printf(1,"%s file does not exist.\n",{file_name})
|
||||
else
|
||||
printf(1,"%s size is %d.\n",{file_name,size})
|
||||
end if
|
||||
end procedure
|
||||
|
||||
test("input.txt") -- in the current working directory
|
||||
test("/input.txt") -- in the file system root
|
||||
3
Task/File-size/Pluto/file-size.pluto
Normal file
3
Task/File-size/Pluto/file-size.pluto
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
for {"input.txt", "/input.txt"} as filename do
|
||||
print(io.filesize(filename))
|
||||
end
|
||||
2
Task/File-size/PowerShell/file-size.ps1
Normal file
2
Task/File-size/PowerShell/file-size.ps1
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
Get-ChildItem input.txt | Select-Object Name,Length
|
||||
Get-ChildItem \input.txt | Select-Object Name,Length
|
||||
4
Task/File-size/Rebol/file-size.rebol
Normal file
4
Task/File-size/Rebol/file-size.rebol
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
size? %info.txt
|
||||
size? %/info.txt
|
||||
size? ftp://username:password@ftp.site.com/info.txt
|
||||
size? http://rosettacode.org
|
||||
2
Task/File-size/Rye/file-size.rye
Normal file
2
Task/File-size/Rye/file-size.rye
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
cc os
|
||||
file-info? %input.txt |print
|
||||
4
Task/File-size/VBScript/file-size.vbs
Normal file
4
Task/File-size/VBScript/file-size.vbs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
With CreateObject("Scripting.FileSystemObject")
|
||||
WScript.Echo .GetFile("input.txt").Size
|
||||
WScript.Echo .GetFile("\input.txt").Size
|
||||
End With
|
||||
Loading…
Add table
Add a link
Reference in a new issue