This commit is contained in:
Ingy döt Net 2013-04-10 21:29:02 -07:00
parent 764da6cbbb
commit db842d013d
19005 changed files with 197040 additions and 7 deletions

View file

@ -0,0 +1,2 @@
"docs" "/docs" [ delete-tree ] bi@
"input.txt" "/input.txt" [ delete-file ] bi@

View file

@ -0,0 +1,5 @@
# Apparently GAP can only remove a file, not a directory
RemoveFile("input.txt");
# true
RemoveFile("docs");
# fail

View file

@ -0,0 +1,7 @@
SYSTEM(DIR="docs") ! create docs in current directory (if not existent), make it current
OPEN (FILE="input.txt", "NEW") ! in current directory = docs
WRITE(FIle="input.txt", DELETE=1) ! no command to DELETE a DIRECTORY in HicEst
SYSTEM(DIR="C:\docs") ! create C:\docs (if not existent), make it current
OPEN (FILE="input.txt", "NEW") ! in current directory = C:\docs
WRITE(FIle="input.txt", DELETE=1)

View file

@ -0,0 +1,4 @@
every dir := !["./","/"] do {
remove(f := dir || "input.txt") |stop("failure for file remove ",f)
rmdir(f := dir || "docs") |stop("failure for directory remove ",f)
}

View file

@ -0,0 +1,5 @@
Directory fileNamed("input.txt") remove
Directory directoryNamed("docs") remove
RootDir := Directory clone setPath("/")
RootDir fileNamed("input.txt") remove
RootDir directoryNamed("docs") remove

View file

@ -0,0 +1,4 @@
File with("input.txt") remove
Directory with("docs") remove
File with("/input.txt") remove
Directory with("/docs") remove

View file

@ -0,0 +1,8 @@
load 'files'
ferase 'input.txt'
ferase '\input.txt'
ferase 'docs'
ferase '\docs'
NB. Or all at once...
ferase 'input.txt';'/input.txt';'docs';'/docs'

View file

@ -0,0 +1,4 @@
NB. =========================================================
NB.*ferase v erases a file
NB. Returns 1 if successful, otherwise _1
ferase=: (1!:55 :: _1:) @ (fboxname &>) @ boxopen

View file

@ -0,0 +1,4 @@
1!:55 <'input.txt'
1!:55 <'\input.txt'
1!:55 <'docs'
1!:55 <'\docs'

View file

@ -0,0 +1,10 @@
' show where we are
print DefaultDir$
' in here
kill "input.txt"
result=rmdir("Docs")
' from root
kill "\input.txt"
result=rmdir("\Docs")

View file

@ -0,0 +1 @@
|era,"input.txt"

View file

@ -0,0 +1,2 @@
erasefile "input.txt
erasefile "/input.txt

View file

@ -0,0 +1,4 @@
-- Here
deleteFile "input.txt"
-- Root
deleteFile "\input.txt"

View file

@ -0,0 +1,5 @@
wd = NotebookDirectory[];
DeleteFile[wd <> "input.txt"]
DeleteFile["/" <> "input.txt"]
DeleteDirectory[wd <> "docs"]
DeleteDirectory["/" <> "docs"]