September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
|
|
@ -1 +1,2 @@
|
|||
ERASE "m"; 1; "INPUTTXT"
|
||||
DELETE FILE "input.txt"
|
||||
DELETE FILE "/input.txt"
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
ERASE "a:INPUTTXT"
|
||||
ERASE "m"; 1; "INPUTTXT"
|
||||
|
|
|
|||
1
Task/Delete-a-file/BASIC/delete-a-file-4.basic
Normal file
1
Task/Delete-a-file/BASIC/delete-a-file-4.basic
Normal file
|
|
@ -0,0 +1 @@
|
|||
ERASE "a:INPUTTXT"
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
VAR
|
||||
l: Files.Locator;
|
||||
BEGIN
|
||||
(* Locator is the directory *)
|
||||
l := Files.dir.This("proof");
|
||||
(* delete 'xx.txt' file, in directory 'proof' *)
|
||||
Files.dir.Delete(l,"xx.txt");
|
||||
END ...
|
||||
|
|
@ -1,13 +1,12 @@
|
|||
#import system.
|
||||
#import system'io.
|
||||
import system'io.
|
||||
|
||||
#symbol program =
|
||||
program =
|
||||
[
|
||||
"output.txt" file_path delete.
|
||||
File new:"output.txt"; delete.
|
||||
|
||||
"\output.txt" file_path delete.
|
||||
File new:"\output.txt"; delete.
|
||||
|
||||
"docs" directory_path delete.
|
||||
Directory new:"docs"; delete.
|
||||
|
||||
"\docs" directory_path delete.
|
||||
Directory new:"\docs"; delete.
|
||||
].
|
||||
|
|
|
|||
8
Task/Delete-a-file/Gambas/delete-a-file.gambas
Normal file
8
Task/Delete-a-file/Gambas/delete-a-file.gambas
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Public Sub Main()
|
||||
|
||||
Kill User.home &/ "input.txt"
|
||||
Rmdir User.home &/ "docs"
|
||||
|
||||
'Administrative privileges (sudo) would be required to mess about in Root - I'm not going there!
|
||||
|
||||
End
|
||||
5
Task/Delete-a-file/Julia/delete-a-file.julia
Normal file
5
Task/Delete-a-file/Julia/delete-a-file.julia
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
# Delete a file
|
||||
rm("input.txt")
|
||||
|
||||
# Delete a directory
|
||||
rm("docs", recursive = true)
|
||||
18
Task/Delete-a-file/Kotlin/delete-a-file.kotlin
Normal file
18
Task/Delete-a-file/Kotlin/delete-a-file.kotlin
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// version 1.0.6
|
||||
|
||||
/* testing on Windows 10 which needs administrative privileges
|
||||
to delete files from the root */
|
||||
|
||||
import java.io.File
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val paths = arrayOf("input.txt", "docs", "c:\\input.txt", "c:\\docs")
|
||||
var f: File
|
||||
for (path in paths) {
|
||||
f = File(path)
|
||||
if (f.delete())
|
||||
println("$path successfully deleted")
|
||||
else
|
||||
println("$path could not be deleted")
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
import os
|
||||
removeFile("input.txt")
|
||||
removeFile("/input.txt")
|
||||
removeDir("docs")
|
||||
removeDir("/docs")
|
||||
5
Task/Delete-a-file/OoRexx/delete-a-file.rexx
Normal file
5
Task/Delete-a-file/OoRexx/delete-a-file.rexx
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/*REXX pgm deletes a file */
|
||||
file= 'afile.txt' /*name of a file to be deleted.*/
|
||||
res=sysFileDelete(file); Say file 'res='res
|
||||
File= 'bfile.txt' /*name of a file to be deleted.*/
|
||||
res=sysFileDelete(file); Say file 'res='res
|
||||
5
Task/Delete-a-file/Phix/delete-a-file.phix
Normal file
5
Task/Delete-a-file/Phix/delete-a-file.phix
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
constant root = iff(platform()=LINUX?"/":"C:\\")
|
||||
?delete_file("input.txt")
|
||||
?delete_file(root&"input.txt")
|
||||
?remove_directory("docs")
|
||||
?remove_directory(root&"docs")
|
||||
25
Task/Delete-a-file/Rust/delete-a-file.rust
Normal file
25
Task/Delete-a-file/Rust/delete-a-file.rust
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
use std::io::{self, Write};
|
||||
use std::fs::{remove_file,remove_dir};
|
||||
use std::path::Path;
|
||||
use std::{process,display};
|
||||
|
||||
const FILE_NAME: &'static str = "output.txt";
|
||||
const DIR_NAME : &'static str = "docs";
|
||||
|
||||
fn main() {
|
||||
delete(".").and(delete("/"))
|
||||
.unwrap_or_else(|e| error_handler(e,1));
|
||||
}
|
||||
|
||||
|
||||
fn delete<P>(root: P) -> io::Result<()>
|
||||
where P: AsRef<Path>
|
||||
{
|
||||
remove_file(root.as_ref().join(FILE_NAME))
|
||||
.and(remove_dir(root.as_ref().join(DIR_NAME)))
|
||||
}
|
||||
|
||||
fn error_handler<E: fmt::Display>(error: E, code: i32) -> ! {
|
||||
let _ = writeln!(&mut io::stderr(), "{:?}", error);
|
||||
process::exit(code)
|
||||
}
|
||||
2
Task/Delete-a-file/Stata/delete-a-file.stata
Normal file
2
Task/Delete-a-file/Stata/delete-a-file.stata
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
erase input.txt
|
||||
rmdir docs
|
||||
13
Task/Delete-a-file/Zkl/delete-a-file.zkl
Normal file
13
Task/Delete-a-file/Zkl/delete-a-file.zkl
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
zkl: System.cmd((System.isWindows and "del" or "unlink") + " input.txt")
|
||||
0
|
||||
zkl: System.cmd((System.isWindows and "del" or "unlink") + " /input.txt")
|
||||
unlink: cannot unlink ‘/input.txt’: No such file or directory
|
||||
256
|
||||
zkl: System.cmd("rmdir docs")
|
||||
rmdir: failed to remove ‘docs’: Directory not empty
|
||||
256
|
||||
zkl: System.cmd("rm -r docs")
|
||||
0
|
||||
zkl: System.cmd("rm -r /docs")
|
||||
rm: cannot remove ‘/docs’: No such file or directory
|
||||
256
|
||||
Loading…
Add table
Add a link
Reference in a new issue