Randomly copy files to an external drive
February 26, 2006 10:59 AM Subscribe
How can I randomly copy files to an external drive?
We've got a plasma screen TV in the lobby at our office that can display a slide show from a memory card. I also have a large collection of portfolio pieces from our building's tenants. I'd like to rotate out a random sampling every week or so.
How can I randomly pull x# of files onto an SD memory card I've got connected to my WindowsXP machine?
We've got a plasma screen TV in the lobby at our office that can display a slide show from a memory card. I also have a large collection of portfolio pieces from our building's tenants. I'd like to rotate out a random sampling every week or so.
How can I randomly pull x# of files onto an SD memory card I've got connected to my WindowsXP machine?
The way I do this is to randomly rename the files with a script. Once they're called "iemsrvoatvkm.jpg" and "tqwmvprlvcja.jpg" and so on, alphabetical sorting is random sorting.
posted by AmbroseChapel at 1:34 PM on February 26, 2006
posted by AmbroseChapel at 1:34 PM on February 26, 2006
No question - Perl.
File::Find will list all the files, rand($nfiles) will select a random file from the list and File::Copy will do the copy.
Think it's overkill to learn a language just for a simple job? Believe me, you will never look back. You will want to add more features to your program, e.g. maintain a permanent record of how many times each file has been selected and once you've learnt a little Perl you'll be able to do almost anything!
On Windows, you can't beat the free http://www.activestate.com/Products/ActivePerl distribution.
posted by denishowe at 2:12 PM on February 26, 2006
File::Find will list all the files, rand($nfiles) will select a random file from the list and File::Copy will do the copy.
Think it's overkill to learn a language just for a simple job? Believe me, you will never look back. You will want to add more features to your program, e.g. maintain a permanent record of how many times each file has been selected and once you've learnt a little Perl you'll be able to do almost anything!
On Windows, you can't beat the free http://www.activestate.com/Products/ActivePerl distribution.
posted by denishowe at 2:12 PM on February 26, 2006
This thread is closed to new comments.
posted by misterbrandt at 11:10 AM on February 26, 2006