Boxerman has asked for the wisdom of the Perl Monks concerning the following question:
Morning all,
I've got a quick question about batching files,
I'm pretty new to Perl so need a pointing in the right way with some explaining.
I would like to make a perl script which search a sub folders of the folder its been told to search and goes through and batches the files in a increaing order, for example:
It creates a folder called Batch1 which has 250 files in there, then Batch2 which has 251, Batch 3 - 252, Batch4 - 253 etc...
How can i do this? Is it possible?
Many thanks!
B-man
Re: Quick Question about batching files
by choroba (Cardinal) on Feb 07, 2013 at 11:39 UTC
|
| [reply] |
|
Hey, thanks for the rapid response! +1
However is there any sites i can use as examples to play with there code? and learn that way (its how i learnt php)
Thanks again, B-man
| [reply] |
|
start with perlintro, perlfaq,
use File::Find::Rule to get an array of file paths, and splice to batch it
follow these links for examples and howto-s
Re: perl find cmd help, Re^2: perl find cmd help, Re: Multiple File Rename, Re^2: Changing filenames
get Modern Perl for reference, see also http://perl-tutorial.org/
Perl documentation documentation, Searching Perl Documentation, How to Read Perldocs, perlintro, Modern Perl, The Perl Monks Guide to the Monastery
| [reply] |
|
Also don't get put off by this
| [reply] |
|
| [reply] |
|
Re: Quick Question about batching files
by tmharish (Friar) on Feb 07, 2013 at 11:49 UTC
|
perl script which search a sub folders
And then you say...
creates a folder called Batch1 which ...
Do you want to read files or write them?
Or do you want to do both? If so, the folders you are reading from - what do they look like? Also which OS ( just in case find . works for you )?
Batch1 which has 250 files in there, then Batch2 which has 251 ...
Batch1 contains 250 files and Batch2 has 251 files or do you want to store files 251 to 500 in it?
Also see How do I post a question effectively?
| [reply] [d/l] |
|
All thanks for your responses and help.
In regards to reading the file, i dont want that, i just want a count of files and sort them in to the folders until there are no more files left.
Thanks B-man
| [reply] |
|
| [reply] |
|
|
|