These forums have been archived and are now read-only.

The new forums are live and can be found at https://forums.eveonline.com/

EVE Technology Lab

 
  • Topic is locked indefinitely.
 

[SOLVED] Selecting files from a list

Author
Nathan WAKE
Deep Core Mining Inc.
Caldari State
#1 - 2011-10-25 10:49:00 UTC  |  Edited by: Nathan WAKE
Hello everyone,

I have a challenge for you (trying the psychological approch to get an answer Big smile).

Does anyone know how to select, let's say, 500 images out of a folder containing 32.000+, based on a list of those images names ? (yes, you guessed it, I'm refering to typeIDs).

My app is nearly ready for release, but I don't want the users (well, futur users) to download and install the whole images folder to their server but only the one needed. And furthermore, I'd like to seperate charges from drones and so on, in different subfolders.

Thus, I'm trying to find a way to select a few , based on their names, out of many images.

Google is usually a good friend, but I only got a way through a .xls file with a .bat file. Any idea or application that could do that ?

"I'm a very good housekeeper. Each time I get a divorce, I keep the house"

Zaza Gabor

Cyerus
University of Caille
Gallente Federation
#2 - 2011-10-25 11:07:42 UTC  |  Edited by: Cyerus
What language do you want the program to be written in?

*edit;
Here's an example for PHP.
Array on the top can easily be made from a for() loop and/or grabbing a list of imagenames from the DB using a SQL query.

Quote:
$listOfImages = array();
$listOfImages[0] = "12345";
$listOfImages[1] = "12346";
$listOfImages[2] = "12347";
$listOfImages[3] = "234567";
// $listOfImages[] = "value";

$mapSource = "source/";
$mapDestination = "destination/";
$size = "_32";

foreach($listOfImages as $thisImage)
{
$check = copy($mapSource . $thisImage . $size . ".jpg", $mapDestination . $thisImage . $size . ".jpg");
if(!check) echo "Error!";
}
Shionoya Risa
The Xenodus Initiative.
#3 - 2011-10-25 11:22:02 UTC  |  Edited by: Shionoya Risa
Just use the EVE Image server and cache the results?

http://image.eveonline.com
Nathan WAKE
Deep Core Mining Inc.
Caldari State
#4 - 2011-10-25 11:25:23 UTC
Thanks for our time Cyerus.

In fact, I will provide a single .php files, along with a css and a js file for my application, AND an image folder to upload to the server.

All I need is a one time shot in order to provide the end-user with only the images he will need.

I am preparing the final package for the release, and the problem I am facing, is selecting the ship/modules/charges/drones and subsystems images out of the CCP package of images (something around 6.000 images out of 32.000+).

I was hoping someone knew of an application (explorer like or so) that could select files based on their names (out of a text export of the typeIDs for example).

I'm not sure I make myself clear Big smile

"I'm a very good housekeeper. Each time I get a divorce, I keep the house"

Zaza Gabor

Nathan WAKE
Deep Core Mining Inc.
Caldari State
#5 - 2011-10-25 11:29:07 UTC
Took me so long to write my answer that I missed Cyrus edit and Shionoya Risa post.

Thanks for your answers, I'll look into that direction. Big smile

"I'm a very good housekeeper. Each time I get a divorce, I keep the house"

Zaza Gabor

Jenn Makanen
Doomheim
#6 - 2011-10-25 11:55:28 UTC
if you've got a unix command prompt to work with (or the ported versions of cat, xargs, changing the cp to a copy)

cat [file with list of filenames]|xargs -i cp {} [path to new location]



Or in a batch file for windows:
FOR /f "tokens=*" %%X IN (list.txt) DO (
:: Check if entry is a directory in the source
IF EXIST %%X\nul (
:: Create if destination directory does not exist
IF NOT EXIST dst\%%X\nul (
MKDIR dst\%%X
)
)
IF NOT EXIST %%X\nul (
COPY %%X dst\%%X /y
)
)
Matalok
Slackers and Nihilists
#7 - 2011-10-25 12:08:22 UTC
Shionoya Risa wrote:
Just use the EVE Image server and cache the results?

http://image.eveonline.com


It has been mentioned by CCP in the past you can use their image server without caching, as its on a CDN anyway. Also if everyone uses the CDN direct the client side caching will not improve your site but other sites that use it as they'll all be referencing this single source.
Shionoya Risa
The Xenodus Initiative.
#8 - 2011-10-25 12:32:36 UTC
Matalok wrote:
Shionoya Risa wrote:
Just use the EVE Image server and cache the results?

http://image.eveonline.com


It has been mentioned by CCP in the past you can use their image server without caching, as its on a CDN anyway. Also if everyone uses the CDN direct the client side caching will not improve your site but other sites that use it as they'll all be referencing this single source.


Indeed.

I only included the caching comment, because quite honestly it's the way I'd set it up and what the OP would be requesting would hardly ever change.

Either way, it is a much better solution than downloading image archives etc etc like we used to have to do.
Nathan WAKE
Deep Core Mining Inc.
Caldari State
#9 - 2011-10-25 13:47:49 UTC
Thank you to all. Mixing your suggestions gave me the solution :

1 - I exported an excel list of typeIDs from the dump by "family" (drones, ships, modules, charges, subsystems - without forgetting the published = 1)
2 - In the excel sheet I inserted : COPY "D:\Types\ here the typeID column _32 " "D:\Types\Modules\"
3 - With the incremental copy, I filled the page with my command
4 - copy paste it in a text file and gave it the .bat extension
5 - run
6 - check the folder for number of file.

Not very elegant I have to admit, but it did the job Big smile

Thanks again to all of you who took the time to answer.

"I'm a very good housekeeper. Each time I get a divorce, I keep the house"

Zaza Gabor

Jenn Makanen
Doomheim
#10 - 2011-10-25 14:25:38 UTC
heh. using excel to create a list of commands. Been there, done that. not the most elegant solution, but for a one off run, it's nice and quick.