SlideShare a Scribd company logo
Tips for Manipulating
Filesystem in Julia
Julia Taiwan 發起人 杜岳華
Print working directory
julia> pwd()
"C:Usersa504082002"
Change directory
julia> cd("D:")
julia> pwd()
"D:"
Make directory
 mkdir(path::AbstractString, mode::Unsigned=0o777)
 `mkdir`
 mkpath(path::AbstractString, mode::Unsigned=0o777)
 `mkdir -p`
julia> mkdir("foo")
copy
julia> cp("D:foo", "D:foo2")
move
julia> mv("D:foo", "D:foo3")
Remove file
julia> rm("D:foo3")
touch
julia> touch("D:foo2test")
Base.Filesystem.File(false,RawFD(-1))
Get basename
julia> dirname("/home/myuser")
"/home"
julia> basename("/home/myuser/example.jl")
"example.jl"
Join path
julia> joinpath("D:", "foo", "bar")
"D:foobar"
Split directory
julia> splitdir("/home/myuser")
("/home", "myuser")
Split drive
julia> splitdrive("D:foo2test")
("D:","foo2test")
Split extensions
julia> splitext("/home/myuser/example.jl")
("/home/myuser/example", ".jl")
julia> splitext("/home/myuser/example")
("/home/myuser/example", "")
Folder traversal
for (root, dirs, files) in walkdir(".")
println("Directories in $root")
for dir in dirs
println(joinpath(root, dir))
end
println("Files in $root")
for file in files
println(joinpath(root, file))
end
end
list segment
 `ls`
julia> readdir()
55-element Array{String,1}:
".atom“
".julia"
".julia_history"
".jupyter"
⋮
"Videos"
"「開始」功能表"
File information
julia> f = open("D:opensource video.txt", "r")
IOStream(<file D:opensource video.txt>)
julia> status = stat(f)
StatStruct(mode=100666, size=65)
julia> status.
blksize blocks ctime device gid inode
mode mtime nlink rdev size uid
julia> status.ctime
1.488506439013989e9
File information
 ctime(file)
 mtime(file)
 filemode(file)
 filesize(path...)
 uperm(file): owner permission
 gperm(file): group permission
 operm(file): other permission
symbolic link (捷徑)
 symlink(target::AbstractString, link::AbstractString)
 `ln –s <target> <link>`
 readlink(path::AbstractString) -> AbstractString
 the target location a symbolic link `path` points to
Change owner or mode
 chown(path::AbstractString, owner::Integer,
group::Integer=-1)
 chmod(path::AbstractString, mode::Integer;
recursive::Bool=false)
temp
 tempname(): generate a unique temporary file path
 tempdir(): generate a unique temporary direcotry path
julia> tempname()
"C:UsersA50408~1AppDataLocalTempjl_FA
AC.tmp"
julia> tempdir()
"C:UsersA50408~1AppDataLocalTemp"
Make temp
 mktemp(parent=tempdir())
 mktempdir(parent=tempdir())
julia> mktemp()
("C:UsersA50408~1AppDataLocalTempjl_7586.tmp
",IOStream(<file
C:UsersA50408~1AppDataLocalTempjl_7586.tmp>))
julia> mktempdir()
"C:UsersA50408~1AppDataLocalTempjl_1A09.tmp"
Thank you

More Related Content

PDF
Puppet Camp Amsterdam 2015: Manifests of Future Past
PDF
Couchdb
PPTX
Ch3(working with file)
KEY
Clojure入門
PDF
You are in a maze of deeply nested maps, all alike
PPTX
Windows Server 2012 Active Directory Recovery
PPTX
Chap 5 php files part-2
PDF
コミュニケーションとしてのコード
Puppet Camp Amsterdam 2015: Manifests of Future Past
Couchdb
Ch3(working with file)
Clojure入門
You are in a maze of deeply nested maps, all alike
Windows Server 2012 Active Directory Recovery
Chap 5 php files part-2
コミュニケーションとしてのコード

What's hot (20)

PPTX
19. CodeIgniter imagini in mysql
PDF
San Francisco Java User Group
PDF
Phishing for Root (How I Got Access to Root on Your Computer With 8 Seconds o...
KEY
Paris js extensions
PDF
MongoDBで作るソーシャルデータ新解析基盤
ODP
Maintaining your own branch of Drupal core
PDF
Shell实现的windows回收站功能的脚本
PDF
Frege is a Haskell for the JVM
PDF
HaskellとDebianの辛くて甘い関係
PDF
MongoDB全機能解説2
TXT
Cpsh sh
PDF
Some Pry Features
PDF
PuppetCamp SEA 1 - Version Control with Puppet
PDF
Introduction to jRuby
PPTX
PDF
Tablespaces
PDF
Klug pgsql tut
PDF
穏やかにファイルを削除する
TXT
PDF
Client-side Storage 
 
19. CodeIgniter imagini in mysql
San Francisco Java User Group
Phishing for Root (How I Got Access to Root on Your Computer With 8 Seconds o...
Paris js extensions
MongoDBで作るソーシャルデータ新解析基盤
Maintaining your own branch of Drupal core
Shell实现的windows回收站功能的脚本
Frege is a Haskell for the JVM
HaskellとDebianの辛くて甘い関係
MongoDB全機能解説2
Cpsh sh
Some Pry Features
PuppetCamp SEA 1 - Version Control with Puppet
Introduction to jRuby
Tablespaces
Klug pgsql tut
穏やかにファイルを削除する
Client-side Storage 
 
Ad

More from 岳華 杜 (20)

PDF
[COSCUP 2023] 我的Julia軟體架構演進之旅
PDF
Julia: The language for future
PDF
The Language for future-julia
PDF
20190907 Julia the language for future
PPTX
Metaprogramming in julia
PPTX
Introduction to julia
PDF
自然語言處理概覽
PPTX
Introduction to machine learning
PDF
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
PDF
Batch normalization 與他愉快的小伙伴
PDF
從 VAE 走向深度學習新理論
PDF
COSCUP: Foreign Function Call in Julia
PDF
COSCUP: Metaprogramming in Julia
PPTX
COSCUP: Introduction to Julia
PPTX
Introduction to Julia
PPTX
20180506 Introduction to machine learning
PPTX
20171127 當julia遇上資料科學
PPTX
20171117 oop and design patterns in julia
PDF
20170807 julia的簡單而高效資料處理
PDF
20170715 北Bio meetup
[COSCUP 2023] 我的Julia軟體架構演進之旅
Julia: The language for future
The Language for future-julia
20190907 Julia the language for future
Metaprogramming in julia
Introduction to julia
自然語言處理概覽
Introduction to machine learning
Semantic Segmentation - Fully Convolutional Networks for Semantic Segmentation
Batch normalization 與他愉快的小伙伴
從 VAE 走向深度學習新理論
COSCUP: Foreign Function Call in Julia
COSCUP: Metaprogramming in Julia
COSCUP: Introduction to Julia
Introduction to Julia
20180506 Introduction to machine learning
20171127 當julia遇上資料科學
20171117 oop and design patterns in julia
20170807 julia的簡單而高效資料處理
20170715 北Bio meetup
Ad

Recently uploaded (20)

PDF
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Machine learning based COVID-19 study performance prediction
PDF
Unlocking AI with Model Context Protocol (MCP)
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
PDF
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PPTX
Big Data Technologies - Introduction.pptx
PPTX
Machine Learning_overview_presentation.pptx
PPTX
Programs and apps: productivity, graphics, security and other tools
PPT
Teaching material agriculture food technology
PDF
Encapsulation theory and applications.pdf
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
1. Introduction to Computer Programming.pptx
PDF
cuic standard and advanced reporting.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Tartificialntelligence_presentation.pptx
PPTX
A Presentation on Artificial Intelligence
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Video forgery: An extensive analysis of inter-and intra-frame manipulation al...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Machine learning based COVID-19 study performance prediction
Unlocking AI with Model Context Protocol (MCP)
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
TokAI - TikTok AI Agent : The First AI Application That Analyzes 10,000+ Vira...
Mobile App Security Testing_ A Comprehensive Guide.pdf
Big Data Technologies - Introduction.pptx
Machine Learning_overview_presentation.pptx
Programs and apps: productivity, graphics, security and other tools
Teaching material agriculture food technology
Encapsulation theory and applications.pdf
Per capita expenditure prediction using model stacking based on satellite ima...
1. Introduction to Computer Programming.pptx
cuic standard and advanced reporting.pdf
A comparative analysis of optical character recognition models for extracting...
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Tartificialntelligence_presentation.pptx
A Presentation on Artificial Intelligence
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf

20171014 tips for manipulating filesystem in julia