September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
21
Task/Rename-a-file/Kotlin/rename-a-file.kotlin
Normal file
21
Task/Rename-a-file/Kotlin/rename-a-file.kotlin
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
// version 1.0.6
|
||||
|
||||
/* testing on Windows 10 which needs administrative privileges
|
||||
to rename files in the root */
|
||||
|
||||
import java.io.File
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val oldPaths = arrayOf("input.txt", "docs", "c:\\input.txt", "c:\\docs")
|
||||
val newPaths = arrayOf("output.txt", "mydocs", "c:\\output.txt", "c:\\mydocs")
|
||||
var oldFile: File
|
||||
var newFile: File
|
||||
for (i in 0 until oldPaths.size) {
|
||||
oldFile = File(oldPaths[i])
|
||||
newFile = File(newPaths[i])
|
||||
if (oldFile.renameTo(newFile))
|
||||
println("${oldPaths[i]} successfully renamed to ${newPaths[i]}")
|
||||
else
|
||||
println("${oldPaths[i]} could not be renamed")
|
||||
}
|
||||
}
|
||||
4
Task/Rename-a-file/Phix/rename-a-file.phix
Normal file
4
Task/Rename-a-file/Phix/rename-a-file.phix
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
?rename_file("input.txt","output.txt")
|
||||
?rename_file("docs","mydocs")
|
||||
?rename_file("C:\\Copy.txt","Copy.xxx")
|
||||
?rename_file("C:\\docs","C:\\mydocs")
|
||||
2
Task/Rename-a-file/Stata/rename-a-file.stata
Normal file
2
Task/Rename-a-file/Stata/rename-a-file.stata
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
!ren input.txt output.txt
|
||||
!ren docs mydocs
|
||||
Loading…
Add table
Add a link
Reference in a new issue