BashScripts.org
http://bashscripts.org/forum/

Create a list of images in a text file inside a script
http://bashscripts.org/forum/viewtopic.php?f=8&t=555
Page 1 of 1

Author:  Wall-e-llaW [ Wed Sep 10, 2008 3:49 am ]
Post subject:  Create a list of images in a text file inside a script

Hi, I would like to create a list of images contained in a folder (ex: /home/Imag). The text file should looks as follows:

# the first line should indicate the number of images in the folder
15
#the next lines should indicate the path and the name of the imgages with the file extension
/home/Imag/Imag1.jpg
/home/Imag/Imag2.jpg
...

Anybody can help me? Thanks all!!!

Author:  myownshadow [ Wed Sep 10, 2008 5:37 am ]
Post subject: 

something like this ?
Code:
#!/bin/bash
ls /home/Imag/ | wc -l  >list.txt
find /home/Imag/  -type f  >> list.txt

Author:  Wall-e-llaW [ Wed Sep 10, 2008 8:35 am ]
Post subject: 

Yeah! That worked ;)

And if I want to call a method that has as arguments the list.txt created and the number of images in that list, how can I do this?

Ex: the method should be called like this: ./move list numImag

Thank you for your help myownshadow ;)

Author:  Wall-e-llaW [ Wed Sep 10, 2008 10:12 am ]
Post subject: 

Forget it, I got it!!

It was quite easy :)

Page 1 of 1 All times are UTC - 6 hours
© 2000, 2002, 2005, 2007 phpBB Group • http://www.phpbb.com