# Return every thing from the current directory
pickFiles(list.files())
# Create a temp file
file.create("myFile")
# Returns subdirectory names and file names with a prefix of "my"
pickFiles(list.files(), prefix = "my")
# create another temp file
file.create("temp.tex")
# Return subdirectory names and file names with a suffix of ".tex"
pickFiles(list.files(), suffix = ".tex")
# clearn up
unlink("myFile")
unlink("temp.tex")
Run the code above in your browser using DataCamp Workspace