I need a Perl script to do the following...
1. I have a collection of 1000000+ audio and video files scattered under a directory called c:\Rawfiles. I would like to run a Perl script that does the following...
2. Search for ALL audio and video files located in this directory named c:\Rawfiles AND underneath this c:\Rawfiles directory and move them to sub-directories named on the file extension. Thus, all .mp3 files go into a sub-dir named c:\Rawfiles\mp3, .avi got into a sub-dir named c:\Rawfiles\avi and so on.
3. The sub-dirs named after the audio-video file extensions may or may not pre-exist in a directory. Some of the audio video files I have seen are: .mp3, .asf, .mp4, .m4v, .mov, .avi, .wmv, .mpg, .mpeg, .rax.
4. There may be many, many sub-directories under c:\Rawfiles that may have further sub-directories that are NOT named after the audio video extension names. The script should traverse down into such directories and search for audio-video files and move all the audio video files to c:\Rawfiles\avi, c:\Rawfiles\mp3, c:\Rawfiles\mpg and so on...
5. At the end of he script run, there will be directories named c:\Rawfiles\avi, c:\Rawfiles\mp3, c:\Rawfiles\mpg and so on located (of course) under c:\Rawfiles. None of these directories named after the audio video file extensions should be empty, if an empty audio video directory is found anywhere (it probably pre-existed) with no files in it, such a directory should be deleted.
6. IMPORTANT: It should be possible to run the script multiple times, as files are added under c:\Rawfiles continually.
Please ask if you have any questions.
Start Free Trial