Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

safer_picture issue! #225

Closed
hedudelgado opened this issue Jan 7, 2016 · 2 comments
Closed

safer_picture issue! #225

hedudelgado opened this issue Jan 7, 2016 · 2 comments

Comments

@hedudelgado
Copy link

Hi there!

I have a little problem..
I built this code.. the target is change the name of the jpg file in my folder.. I does not work.. I thought it might not be pointing at the folder.. its that way I added the block creating a txt file, the point is that the code create the file, which means is pointing at the folder.. however..the problem is either not pointing at the jpg files or the block code does not work.. I think is not pointing at the files because the downloading files does not increase the counter..
info: the folder has three jpg files, therefore.. the each do should print three times the art into the files.. but it only writes once "asasasasaaasasasaasasasasasasasaa'"

what do you think?

thank you!

Dir.chdir'/Users/sorry/desktop/photos'
pic_names = Dir['Users/sorry/desktop/photos/*/.jpg']

require 'yaml'

test_arr= ['asasasasaaasasasaasasasasasasasaa']

test_arr = test_arr.to_yaml
filename='prueba.txt'

File.open filename, 'w' do |x|
x.write test_arr
end

pic_names.each do |a|
prints 'asdadadada'
end

the block above demostrate its pointing at the folder..

the block bellow

puts 'How would you like to name your photos?'
newname = gets.chomp

puts
print "Downloading #{pic_names.length} photos: "

pic_number = 1
pic_names.each do |x|
print '.'

new_name = if pic_number < 10
"#{name}0 #{pic_number}.jpg"
else
"#{name} #{pic_number}.jpg"
end
File.rename name, newname
pic_number = pic_number + 1
end

@nikeshashar
Copy link
Contributor

@hedudelgado you should open this ticket in the pre_course repo, not here. It won't show up anywhere for your team to check.

Also for future advice, you should put any code in blocks with a backtick on either side so it looks like this

@hedudelgado
Copy link
Author

thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants