Sponsored Content
Top Forums Programming Script for creating a directory & move the .tif files in it. Post 302630127 by paragnehete on Wednesday 25th of April 2012 12:14:27 PM
Old 04-25-2012
Script for creating a directory & move the .tif files in it.

Hi Team,

I have thousands of TIF files which are converted from PDF. Below is a sample of it.

LH9406_BLANCARAMOS_2012041812103210320001.tif
LH9406_BLANCARAMOS_2012041812103210320002.tif
LH9406_BLANCARAMOS_2012041812103210320003.tif
LH9411_ANGENIAHUTCHINSON_2012041812102510250001.tif
LH9411_ANGENIAHUTCHINSON_2012041812102510250002.tif
LH9411_ANGENIAHUTCHINSON_2012041812102510250003.tif
LH9411_ANGENIAHUTCHINSON_2012041812102510250004.tif
LH9411_ANGENIAHUTCHINSON_2012041812102510250005.tif
LH9412_DANIELMATEO_2012041812102310230001.tif
LH9412_DANIELMATEO_2012041812102310230002.tif
LH9414_MICHAELLEWIS_2012041812102010200001.tif
LH9414_MICHAELLEWIS_2012041812102010200002.tif
LH9414_MICHAELLEWIS_2012041812102010200003.tif
LH9414_MICHAELLEWIS_2012041812102010200004.tif

I want to create folders like LHR-001,LHR002,LHR-003.....& w ant to move approximately 50 to 60 images in one folder in such a way that all images of first part of file name should be in one folder.

eg. If first 50 files moves in LHR-001 folder & 50th file is
LH9411_ANGENIAHUTCHINSON_2012041812102510250003.tif then it should move the remaining 2 files (LH9411_...004.tif & LH9411_...005.tif) also in LHR-001. Means count of that folder is 52 & afterwards it goes further to move files in LHR-002.


I have a script which create a folder & moves 50 files in it but that script moves exact 50 files. The problem is, if i run that script the sometimes images from single PDF are split in two folders. Here is my script sample....

cc=50; c=0; folder=1; for i in *; do c=`expr $c + 1`; let "r = $c % $cc" ; if [ $r -eq 0 ] ; then folder=`expr $folder + 1` ; fi ; if [ ! -d $folder ]; then mkdir $folder; fi ; mv "$i" $folder/ ;done

Please help me out.

Thank You.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Move all files in a directory tree to a signal directory?

Is this possible? Let me know If I need specify further on what I am trying to do- I just want to spare you the boring details of my personal file management. Thanks in advance- Brian- (2 Replies)
Discussion started by: briandanielz
2 Replies

2. UNIX for Dummies Questions & Answers

sample script to archive & move previous day syslog files

hi all. Please help me with archiving previous day syslog files. the files have no extension and have the format YYYY-MM-DD. I want to archive the file then move it to some other machine. thanks. (2 Replies)
Discussion started by: coolatt
2 Replies

3. Shell Programming and Scripting

Script That Can navigate to 3 differents directory & remove files under them

Hi I am Trying to Write a script that can goto 4 different directorys on the server & remove the Files older then 30 days ?? /logs logs1 logs2 logs3 Now I need to remove files under logs1 logs2 logs3 which are older then 30 days whose name stat 'sit' , 'mig','bld' . in... (3 Replies)
Discussion started by: Beginner123
3 Replies

4. Shell Programming and Scripting

Script to move files to a directory according to date

hi all, here is the description to my problem. input parameter: $date1 based on the date i need to select three files starting with audit.log* based on its modified date, a date before, a date after(if its exists). We need to compare the input date to modified date of the file. And then... (3 Replies)
Discussion started by: ashrocks
3 Replies

5. Linux

Create folder by script & move files in it

Hi Team, I have over 1 lakh pdf files. I want to create folders like Disk-1, Disk-2 ..... & want to move 3000 pdfs per folder. Can i do it by script? Please help me. Thanks & Regards Parag Nehete (4 Replies)
Discussion started by: paragnehete
4 Replies

6. Shell Programming and Scripting

Script to search for a character in files in a Directory & remove it

Hi All, Am new to both Unix & this Forum - Need some help on a script that I am trying to write: In a Directory i have few text files which might or might not contain some text that I am trying to find. Once that text is found in any of the files, it needs to be removed from the file ... (6 Replies)
Discussion started by: rituparna_gupta
6 Replies

7. UNIX for Dummies Questions & Answers

Move Directory & Contents Between Two Machines

Hi All, I have a large amount of files that I need to copy from one server to another server using SFTP. Can comeone please help me with the command I would use here? Here is what I am thinking, but being new at this I know this is probably wrong: Login to the destination host using... (1 Reply)
Discussion started by: SalientAnimal
1 Replies

8. Shell Programming and Scripting

List files with date, create directory, move to the created directory

Hi all, i have a folder, with tons of files containing as following, on /my/folder/jobs/ some_name_2016-01-17-22-38-58_some name_0_0.zip.done some_name_2016-01-17-22-40-30_some name_0_0.zip.done some_name_2016-01-17-22-48-50_some name_0_0.zip.done and these can be lots of similar files,... (6 Replies)
Discussion started by: charli1
6 Replies

9. UNIX for Dummies Questions & Answers

How to move gz files from one source directory to destination directory?

Hi All, Daily i am doing the house keeping in one of my server and manually moving the files which were older than 90 days and moving to destination folder. using the find command . Could you please assist me how to put the automation using the shell script . ... (11 Replies)
Discussion started by: venkat918
11 Replies

10. Shell Programming and Scripting

Need BASH Script Help to Move Files While Creating Directories

I've got this script to loop through all folders and move files that are more than 2 years old. I'm using the install command because it creates the necessary directories on the destination path and then I remove the source. I'd like to change the script to use the mv command since it is much... (4 Replies)
Discussion started by: consultant
4 Replies
rgb2ycbcr(1)							   User Commands						      rgb2ycbcr(1)

NAME
rgb2ycbcr - convert non-YCbCr TIFF images to YCbCr TIFF images SYNOPSIS
rgb2ycbcr [options] src1.tif [src2.tif...] dest.tif DESCRIPTION
rgb2ycbcr converts RGB color, grayscale, or bi-level TIFF images to YCbCr images by transforming and sampling pixel data. If multiple files are specified on the command line, each source file is converted to a separate directory in the destination file. By default, chrominance samples are created by sampling 2 by 2 blocks of luminance values, and output data files are compressed with the LZW compression scheme, with each strip no more than 8 kilobytes. These characteristics can be overridden or explicitly specified with the options described below. OPTIONS
The following options are supported: -c Specify a compression scheme to use when writing image data: -c jpeg Baseline JPEG compression algorithm. -c lzw Lempel-Ziv and Welch algorithm. This is the default algorithm. -c none No compression. -c packbits PackBits compression algorithm. -h Set the horizontal sampling dimension to one of the following: 1, 2, or 4. The default value is 2. -r Write data with a specified number of rows per strip. By default, the number of rows per strip is selected so that each strip is approximately 8 kilobytes. -v Set the vertical sampling dimension to one of the following: 1, 2, or 4. The default value is 2. OPERANDS
The following operands are supported: src.tif The name of the input file that contains non-YCbCr TIFF data. dest.tif The name of the output file that contains YCbCr TIFF data. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWTiff | +-----------------------------+-----------------------------+ |Interface stability |External | +-----------------------------+-----------------------------+ SEE ALSO
tiffinfo(1), tiffcp(1), libtiff(3) NOTES
Updated by Breda McColgan, Sun Microsystems Inc., 2004. SunOS 5.10 26 Mar 2004 rgb2ycbcr(1)
All times are GMT -4. The time now is 04:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy