Register
It is currently Tue Sep 02, 2014 8:08 pm

Create a list of images in a text file inside a script


All times are UTC - 6 hours


Post new topic Reply to topic  [ 4 posts ] 
Author Message
 PostPosted: Wed Sep 10, 2008 3:49 am   

Joined: Wed Sep 10, 2008 3:28 am
Posts: 3
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!!!


Top
 Profile  
 PostPosted: Wed Sep 10, 2008 5:37 am   
User avatar

Joined: Sun Apr 13, 2008 4:05 am
Posts: 37
Location: /dev/random
something like this ?
Code:
#!/bin/bash
ls /home/Imag/ | wc -l  >list.txt
find /home/Imag/  -type f  >> list.txt


Top
 Profile  
 PostPosted: Wed Sep 10, 2008 8:35 am   

Joined: Wed Sep 10, 2008 3:28 am
Posts: 3
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 ;)


Top
 Profile  
 PostPosted: Wed Sep 10, 2008 10:12 am   

Joined: Wed Sep 10, 2008 3:28 am
Posts: 3
Forget it, I got it!!

It was quite easy :)


Top
 Profile  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  


BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group
© 2003 - 2011 USA LINUX USERS GROUP