I've got a bunch of files I need to pull from various locations and process them individually.
I'd like to store the information on their location and filename along with an ID to process them by in an array, and split on a delimiter like say a comma.
This is all basicly sudo code I'm writing as i think about it, I know that I don't know what i need but I'm hopfully close enough to explain my need :D
Please let me know if you have trouble following what I'm after, I'm sure what i need is relatively simple, I just don't do much in the way of arrays# Source Location, Filename, An ID that I need for file processi +ng @array('C:\Source1\', 'File1.txt', 'ReferenceIDForProcessing' 'D:\Source2\sub\', 'File2.txt', 'ReferenceIDForProcessing' 'E:\Source3\sub2\', 'File3.xml', 'ReferenceIDForProcessing' 'C:\Source4\', 'File4.pgp', 'ReferenceIDForProcessing'); # Assuming the syntax is even close, how do I then irrerate over that +array to process each line or grouping? # I'm hoping to do a loop something like this $centralLocation = "Z:\Processing\"; open(FILES, "<@array") or die $!) ; while (<FILES>) { $line = $_ ; chomp($line) ; @FILE = split(/,/, $line) ; # Split each line into the 3 differ +ent parts. (Example in first line of the array) Move (@FILE[0]@FILE[1],$centralLocation); # Now all files would be + in a central location for processing (ie: Move C:\Source1\File1.txt +to Z:\Processing) Process ($centralLocation@FILE[1], @FILE[2]); # How the sending wo +rks is irrevlant, only that I can put the @info[2] there for each fil +e to process. } close(FILES);
In reply to Howto build an (associative?) array to process files in different locations by shadowfox
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |