DPChallenge: A Digital Photography Contest You are not logged in. (log in or register
 

DPChallenge Forums >> Tips, Tricks, and Q&A >> Select 1724
Pages:  
Showing posts 1 - 14 of 14, (reverse)
AuthorThread
03/29/2005 12:01:56 PM · #1
I need some advice. I have a generated text file with the images I need for a photomosaic. Now I need to manually select the 1724 original images from 2600 images by hand. Is there any way to do this batch-wise? I have a list with all the filenames. It's such a stupid job. A computer could do it in ten seconds, I'll need 5 hours.
Any suggestions on how to do this? A program maybe? A simple trick?
03/29/2005 12:07:04 PM · #2
Lets see if i understand the question...
start with #1 - XP, Mac, or what?

You have a directory with 2600 files. you have a text file with 1724 file names. you need to copy or move those 1724 files from the directory with 2600 to another directory.

Yes??

Do you have any programming languages at hand? (basic, pascal, etc) VBA is in Word/Excel etc, but i am not familiar with it, but it might be able to do it.

DOS batch files can still be run under XP...you could use a find and replace on the text file to do this...

copy C:/bigdirectory/XXXX.XXX to d:/moscaicdirectory/

Getting the beginning and end or putting the XXXX.XXX is the hard part...Excel could be used - put the first part in Column A, import your tesxt file to column B, the last part in column C, and export the whole thing as a text file again, rename it "move.bat" and run it.

those are my ideas...
03/29/2005 12:12:19 PM · #3
mkdir mosaic
vi listfile
s/^\(.*\)/cp \1 mosaic/
:wq
sh ./listfile

But I'm guessing you're not on Unix/Linux or you'd have done that by now : )
03/29/2005 12:15:46 PM · #4
I know this will reveal my age, who uses .bat files anymore, but could you use a DOS batch file to copy or move the files where you want them?

Copyfile.bat

copy %1file.ext %2
copy %1file2.ext %2

Here is how you would use it:

C:\>copyfile C:\ C:\CopyDirectory\

It would probably be easy to insert the copy %1 before your file name and %2 after. The %1 and %2 just give you a bit more flexibility as to specifying locations.

2Shay
03/29/2005 12:37:48 PM · #5
Prof Fate, you understood right. That's what I want to do. Unfortunately, the only coding I'm familiar with is HTML...no use here. I don't understand your guidelines for a batch file very well.
So what I need is a file like the one I have, with all the names, that looks like
copy C:/bigdirectory/file001a.jpg to d:/moscaicdirectory/
copy C:/bigdirectory/file235h.jpg to d:/moscaicdirectory/
copy C:/bigdirectory/file951c.jpg to d:/moscaicdirectory/
...
and rename that to *.bat ?
Nothing else? No other coding?

Ah, yes, I'm running XP :)
03/29/2005 12:47:26 PM · #6
I would just use VBA in Excel to do it, but that's just cuz that's the language I'm familiar with. It would be pretty quick.
03/29/2005 12:58:39 PM · #7
gloda, thats right...
___________________
filelist.txt
-------------------
file001.jpg
file002.jpg
filexxx.jpg
___________________

find and replace "file" with "copy c:\location\file"
then find and replace ".jpg" with ".jpg c:\newlocation"

rename filelist.txt to fileconvert.bat
then run it


03/29/2005 01:11:35 PM · #8
Thanks, I'm trying that.
03/29/2005 02:38:56 PM · #9
It doesn't work. Here's the first line:
copy C:\all\20050125 11h44'38'' by Gilles Glod (PowershotG2).jpg to C:/selection/
The program says it can't find the files. Is that because of the spaces? There are some 'é's too. Or does the batch file have to be in a specific place?
03/30/2005 12:59:27 AM · #10
If you give it the full path for the from and to, you should be fine, otherwise the batch file will do it relative to where it is now. batch files date back to dos 1.1 or even 1.0 maybe.

make sure hte new directory already exists. let me go play a bit...

alrighty then...ALL directory names in the path have to be under 8 characters AND no spaces. Basic basic basic naming conventions.

if you need to make a text file of the directory listing:

START - RUN - type in COMMAND.COM - you get an old fashioned dos window.
using CD move to the directory you need a list of - and type this DIR > dirtest.txt then you can open that file in notepad.

proper syntax for the copy command is:

copy flag1\img_0305.jpg flag2\
WHERE you are in the directory above FLAG1 and FLAG2, and flag1 and flag2 are the names of the proper directories. In my case, the whole path is [/b]E:\2005\flag1[/b] and my prompt says e:\2005>

Now to move the list...

this is getting too hard...back to Basic...go to //www.geocities.com/Area51/5967/qbasic.html and dowload qbasic1.1. stick it in some directory, and then copy from there the one file QBASIC.EXE to the directory above the files to be copied...in my exapmle, the E\2005\ directory...

Message edited by author 2005-03-30 01:26:31.
03/30/2005 01:13:58 AM · #11
Yes, DOS doesn't know what a space is, I beleive it's %20 that needs to be replaced for the space. I'm sure one of the heavier coders would be able to answer that more accurately.
03/30/2005 01:47:37 AM · #12
ok, this is the basic program you need to copy in notepad, save it as moveit.bas and then start the QBASIC, and load moveit.bas. then run it (F5).

then go to START - RUN - COMMAND.COM and navigate to the directory (e:\2005 in my example) and run the batch file MOVEIT.BAT.

make sure the new directory exists.
the program will ask your for the follwing info:
originating directory - FLAG1 in my exapmpe (no slashes)
destination - FLAG2 in my exapmle (no slashes)
name of file with file names in it... enter it (filelist.txt or whatever it is)
that should do it...you can drag and drop the .bat file in notepad to see if it looks right.

10 PRINT "------- NEW RUN------"
30 b$ = "flag1\"
40 C$ = "flag2\"
INPUT "Enter the original directory with no last slash: ", b$
INPUT "Enter the destination direcory with no last slash: ", C$
b$ = b$ + "\"
C$ = C$ + "\"
INPUT "Enter the name of the file with the list in it - with extension: ", f$
42 OPEN f$ FOR INPUT AS #1
OPEN "MOVEIT.BAT" FOR OUTPUT AS #2
49 IF EOF(1) THEN 90
50 LINE INPUT #1, a$
60 D$ = "copy " + b$ + a$ + " " + C$ + a$
70 PRINT #2, D$
80 GOTO 49
90 CLOSE #1
CLOSE #2
PRINT "MOVEIT.BAT created. Open a COMMAND.COM window and run it"
100 END

Sorry this isn't pretty...but it works. Been a LONG time sine i played in basic, and rarely in qbasic, hence the mishmash of line numbers and no line numbers. also, it is about 2 am here...

Message edited by author 2005-03-30 01:49:01.
04/01/2005 03:14:35 AM · #13
WTF? Wow, thanks for all the work you put into this prof_fate. I just got out of bed, so this looks like a big code mess to me but I'll try to get this done as soon as I've had some coffee...
04/02/2005 07:13:07 AM · #14
Yeeha! It worked!
I didn't use all that Basic stuff though. I ran the batch file. But I renamed the folders to the 8 characters standard and removed all characters like 'é' '&' '"' and the spaces from the filenames. I guess that was the problem first. I think I also messed up / and \ once. It's been a long time since I worked in DOS.
Thank you all for helping me so much!

Now I can proceed with the next stage of batch processing :/
I need to join those pics together, 4 at a time. That means, I take 1718 files of 1024x683px and end up with 430 files of 2048x1366px.
What I'd do now is open four files, paste them into one new file and arrange them into the four corners by batch in PaintShopPro9. I'd have to copy/paste/quickscript/saveAs 1718 times...
I know I've asked a lot already, but perhaps somebody might help me with this?
Pages:  
Current Server Time: 09/14/2025 01:11:27 PM

Please log in or register to post to the forums.


Home - Challenges - Community - League - Photos - Cameras - Lenses - Learn - Help - Terms of Use - Privacy - Top ^
DPChallenge, and website content and design, Copyright © 2001-2025 Challenging Technologies, LLC.
All digital photo copyrights belong to the photographers and may not be used without permission.
Current Server Time: 09/14/2025 01:11:27 PM EDT.