Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I want to monitor (by cron, I got that part covered :P) new audio files in folders so I can add them toa separate XML files which act as an podcast RSS feed. The file structure looks like this:

- Podcasts
-- Show number one
--- Audio file of the show for week one.mp3
--- Audio file of the show for week two.mp3
-- Show number two
--- Audio file of the show for week one.mp3
--- Audio file of the show for week two.mp3
-- So on

The audio file creation is automated by a computer in our studio, that uploads them to our ubuntu server so the files are accessible publicly. Now, the idea is to make everything automated because we only have volounteers and they're lazy! :)

Now, the script would need to monitor for new folders into "podcast" and new audio in "show number X" folders. Everytime there is a new show folder, I need to create a new XML file for that specific show podcast and everytime there is a new audio in a show, I need to add it to the show's XML.

Now I know the structure of XMLs just fine, I'm just completely in the dark when it comes to bash scripts. How can I make a script that looks for new file and folders? Can the script write within an XML file?

Regards,

share|improve this question

2 Answers 2

Take a look at iwatch

apt-get install iwatch

From man page:

iwatch - a realtime filesystem monitor / monitor any changes in directories/files specified

Example:

iwatch /tmp -e create -c <your command/script>

Explain:

watch folder /tmp for new created files/folders. For each new created file/folder run command your command/script

In your case you could run a script which generate this XML files.

I can't give you a more detailed answer, but maybe it's a good start point for better answers :)

share|improve this answer
    
I will be checking into that soon! –  Jean-Philippe Murray Jun 12 '13 at 15:13

There might be other ways to edit XML files in bash, but something like XMLStarlet might work for you. Sorry this answer is split out between me and Wolfy.

share|improve this answer
    
Will be checking this soon enough, I'll get back with results! :) –  Jean-Philippe Murray Jun 12 '13 at 15:13

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.