problems with escaped characters in file::stat

T

tigerd

Hey.
I hva got a really mindchrusher problem. I've made a program that
somewhere goes through a list of files, picked with a tar command, and
then collects the size and time of every single file/dirs. It goes
something like this:

system("tar --totals -cvf /dev/null -C #{@basedir} #{directory} >
#{@tempfile} 2> /dev/null")
templist = File.new(tempfile)
while file = templist.gets
next if file == nil
file = file.chop
if file =~ /.*?\/$/
stat_d = File::Stat.new(File.join(TEMPDIR, file)) if
(@mode['static'] == nil)
stat_d = File::Stat.new("#{@basedir}/#{file}") if
(@mode['static'] != nil)
end
end

The problem now is that if a file has a special character, tar puts the
filename like this

1. /../path/bioligep\345.psd
this file ruby cannot find, since the name in the unix-world is(its on
a linux platfom)
2. /../path/bioligep?.psd

My question is: Is there anyway I can translate the line no. 1 into
line no 2? Ive looked at the File.fnmatch but havent really gotten
anywere

Greeting, Allan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top