Announcing the new Datavyu v1.4.0 with enhanced features, bug fixes, and a new video player for Windows!

We are in the process of migrating away from this forum—feel free to browse existing help topics. For new support inquiries, please reach out to us via email at

I have a print script that is written to loop over multiple files. When I run it, it loads the first file, then crashes. Here is the relevant code:

#Sets the file path of where the files are.
filedir = File.expand_path("~/Desktop/BatchAct/")
filenames =

#Begin loop over files
for file in filenames

    if file.include?(".opf") and file[0].chr != '.'

    puts "LOADING DATABASE: " + filedir+file
    $db,proj = load_db(filedir+file)

I noticed that when it gives the name of the file it just loaded, it says "LOADING DATABASE: C:/Users/Whitney/Desktop/BatchActCrawlers5.opf". The slash between the folder and the file name is missing.

asked 13 Aug '13, 10:53

WhitneyCole's gravatar image

WhitneyCole ♦
accept rate: 21%

File.expand_path removes the slash from the end of the file path, so the slash needs to be added back in like this:

filedir = File.expand_path("~/Desktop/BatchAct/") + '/'
permanent link

answered 13 Aug '13, 10:54

WhitneyCole's gravatar image

WhitneyCole ♦
accept rate: 21%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:


question asked: 13 Aug '13, 10:53

question was seen: 3,093 times

last updated: 13 Aug '13, 10:54

powered by OSQA