bash - batch processing folder of files by name


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting bash - batch processing folder of files by name
# 1  
Old 07-13-2009
bash - batch processing folder of files by name

Hello Everyone!!!

I need some help with a shellscript to batch process a folder of files with the imagemagick convert -append/+append command. The folder contains some hundred or thousand of small images in .png format which I would like to join together in order of their filenames. The filenames follow a pattern like this:

File 1: 11.123456_8.043589.png
File 2: 11.123456_9.320411.png
File 3: 12.843211_8.043589.png
File 4: 12.843211_9.320411.png

What I want to do is join all files with the same number in the first part of the filename (before the underscore) with the convert +append command to a row and afterwards join these rows together with the convert -append comand. This could also be a second script, if easier.
I figured out the imagemagick part of this, but as an absolute beginner to shellscripting, I have no clue how to get a appropriate shellscript up and running. I have searched the forum but didn't find anything that worked out for me or pointed me in the right direction. I would really appreciate some help here!

Greetings,

Gerd
# 2  
Old 07-13-2009
I dont know imagemagick convert -append/+append command
so, if you could explain the output you desire with the example, may be I can help.
# 3  
Old 07-13-2009
Quote:
Originally Posted by rakeshawasthi
I dont know imagemagick convert -append/+append command
so, if you could explain the output you desire with the example, may be I can help.
Thank you for the quick response! Well, the desired output is a big image of all files in that folder. The imagemagick convert command joins given imagefiles together, either vertically (-append) or horizontally (+append). So what the script should do is select the files that belong together by the first part of the filename and then join them via the convert comand and save them with a prefix and the first part of the name, then select the next files that belong together...join and save them...and so on. At the end I would end up with a bunch of horizontally joined files, for example:

row_11.123456.png (File1 and File2)
row_12.843211.png (File3 and File4)

In a second step these files again will be combined vertically, but I think this can be achieved simply by running the convert -append command on them. Hope I could make it a bit more clear...
# 4  
Old 07-13-2009
Tried google, cant find much...
but you will need find and xargs ...
Sorry for not being of much help.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Simply Bash Script to Confirm that there are 2 Files in Same Folder

Im looking for 2 Files -> *.WAV and *.wav with find . -name 'unavail.wav' -o -name 'unavail.WAV' I need to list the Folders that contains these 2 Files? Thx in advance (13 Replies)
Discussion started by: valdez
13 Replies

2. UNIX for Beginners Questions & Answers

Batch processing files through an interactive script

I am newish to the site and to unix. I have a functioning interactive script running on Mac that sorts and processes files located in an unsorted folder on my desktop. As it currently stands, the user types jpg into the command line, the script executes and iterates through the unsorted... (8 Replies)
Discussion started by: Braveheart
8 Replies

3. Shell Programming and Scripting

Need help in batch renaming files with bash shell script.

I have some 50+ files in the following format : abcd_vish_running_ZEBRA_20140818.dat_08-14-2014_23:08:23 abcd_vish_running_ZEB-RA_20140818.dat_08-14-2014_23:08:35 abcd_vish_running_ZEB_RA_20140818.dat_08-14-2014_23:08:37 abcd_vish_running_RI-NG_20140818.dat_08-14-2014_23:08:42... (5 Replies)
Discussion started by: SriRamKrish
5 Replies

4. Shell Programming and Scripting

Passing multiple files to awk for processing in bash script

Hi, I'm using awk command in bash script. I'm able to pass multiple files to awk for processing.The code i can use is as below(sample code) #!/bin/bash awk -F "," 'BEGIN { ... ... ... }' file1 file2 file3 In the above code i'm passing the file names manually and it is fine till my... (7 Replies)
Discussion started by: shree11
7 Replies

5. Shell Programming and Scripting

Sftp batch processing commands

Hello, I have a UNIX script to sftp batch processing. Here is my sftp command. ftp -b toopc userid@sftp.hostname.com In the file toopc I have the following commands: mget *.csv bye This brings in all files with an extension of .csv However, I need to only bring in files that ... (6 Replies)
Discussion started by: schlinzj
6 Replies

6. Shell Programming and Scripting

Executing a batch of files within a shell script with option to refire the individual files in batch

Hello everyone. I am new to shell scripting and i am required to create a shell script, the purpose of which i will explain below. I am on a solaris server btw. Before delving into the requirements, i will give youse an overview of what is currently in place and its purpose. ... (2 Replies)
Discussion started by: goddevil
2 Replies

7. UNIX for Dummies Questions & Answers

Bash script to rename all files within a folder...

Hi. I don't have any experience with making scripts in bash. I need a simple script to rename all files in a folder to the format file1.avi, file2.avi, file3.avi, and so on..... Please note that the original files have different filenames and different extensions. But they all need to be... (2 Replies)
Discussion started by: dranzer
2 Replies

8. Shell Programming and Scripting

Bash folder manipulation - selecting/copying specified files

Bash/scripting newbie here - I feel this might be a trivial problem, but I'm not sure how to tackle it. I've got a folder of a year's worth of files, with some random number of files generated every day of the year (but at least one per day). I'm writing a script to automatically grab the file with... (6 Replies)
Discussion started by: WildGooseChased
6 Replies

9. Shell Programming and Scripting

Processing different jobs as a batch process

Hi All, I want to process consecutive jobs in a sequence but when I execute 1 job ,the control does not return to the command prompt to continue with the next job. Can anyone help me here? Thanks (3 Replies)
Discussion started by: Taranjeet Singh
3 Replies

10. Shell Programming and Scripting

bash - batch script for extracting one file from multiple tar files

so i have hundreds of files named history.20071112.tar (history.YYYYMMDD.tar) and im looking to extract one file out of each archive called status_YYYYMMDDHH:MM.lis here is what i have so far: for FILE in `cat dirlist` do tar xvf $FILE ./status_* done dirlist is a text... (4 Replies)
Discussion started by: kuliksco
4 Replies
Login or Register to Ask a Question