Copy a file based on the size-Urgent


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Copy a file based on the size-Urgent
# 1  
Old 02-16-2010
MySQL Copy a file based on the size-Urgent

Hi,

I need unix code to check the size of a file. for example if the size of the file in A folder is more than 1BM, then i have to move that particular file in to B folder whenever I run that particular script.

regards,
Srinivas.
# 2  
Old 02-16-2010
Code:
find ~ -size +1M

Finds the file which are bigger than 1MB. You can move it as
Code:
find ~ -size +1M -exec mv {} /somewhere/ \;

# 3  
Old 02-16-2010
thanks a lot for your information.

if i want to zip and copy(if the file size is in GB's?)? what would be the command?
# 4  
Old 02-16-2010
What Operating System and version do you have?
How big is your largest file?
# 5  
Old 02-16-2010
the file size is 3.5 GB and the OS is AIX 6.1
# 6  
Old 02-16-2010
My first reaction is to use unix "compress" command but it's better if an AIX expert comments.
# 7  
Old 02-16-2010
methyl, can you pls give your idea how the exact script would be?
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare file size and then copy/overwrite

// Redhat I have this code working, but need to add one more qualification so that I don't overwrite the files. #!/bin/sh cd /P2/log/cerner_prod/millennium/archive/ for f in * do || continue #If this isn't a regular file, skip it. && continue #If a backup already... (2 Replies)
Discussion started by: Daniel Gate
2 Replies

2. Shell Programming and Scripting

Split the File based on Size

I have a file that is about 7 GB in size. The requirement is I should split the file equally in such a way that the size of the split files is less than 2Gb. If the file is less than 2gb, than nothing needs to be done. ( need to done using shell script) Thanks, (4 Replies)
Discussion started by: rudoraj
4 Replies

3. Shell Programming and Scripting

Split file based on size

Hi Friends, Below is my requirement. I have a file with the below structure. 0001A1.... 0001B1.. .... 0001L1 0002A1 0002B1 ...... 0002L1 .. the first 4 characters are the sequence numbers for a record, A record will start with A1 and end with L1 with same sequence number. Now the... (2 Replies)
Discussion started by: diva_thilak
2 Replies

4. Shell Programming and Scripting

Moving a file based on size

hello, I am creating a script that is going to scan the contents of a directory, and if it finds a certain DocumentName that is a certain size (The example, DocumentName and a size of 8777) If this file exists, it needs to be moved to a directory for later removal/processing..anyone have... (7 Replies)
Discussion started by: jeffs42885
7 Replies

5. Shell Programming and Scripting

Need to move a file based on size

Hi All, I have some files in a directory. If the file size is 0 i want to move the file to new directory using unix script. Can anyone help me in this regard Thanks Vinny (4 Replies)
Discussion started by: vinny81
4 Replies

6. Shell Programming and Scripting

To copy a a file to last created directory..Urgent pls

I need to copy a file example hhh.txt to the recently created directory by name flexite@latesttimestamp in the path interface/home/ ... I couldnt get the name of recently created directory .... first result of ls -lst ...that is ls -lst |head -2 gives the latest directory but i could not... (2 Replies)
Discussion started by: helloo
2 Replies

7. Shell Programming and Scripting

URGENT HELP NEEDED ON -File size reading

All Expert, I am using Sun OS 5.8 and Perl version 5 in One server and Perl 5.8 in another unix server. I am able to read a file using fopen function of perl --file size having more then 3 GB of data.(In the machine where Perl 5.8 install) But when i am running the same perl script --It... (1 Reply)
Discussion started by: jambesh
1 Replies

8. UNIX for Dummies Questions & Answers

ftping a file based in the size

Hi, I want to connect to a remote machine using FTP, check for the size of a file there. If it is 0 bytes, then there is no need to ftp else i have to ftp the file. Any help will be highly appreciated. (7 Replies)
Discussion started by: vikas.rao11
7 Replies

9. Shell Programming and Scripting

Copy the first & third columns in to another test file. Its very urgent please

Hello friends! Here is the scenario. I have a flat file named FILE1.TXT with multiple columns and comma as delimiter. Now my task is to create another file called FILE2.TXT which contains the FIRST & THIRD column values from FILE1.TXT separated by comma. Which mean i am creating a new... (5 Replies)
Discussion started by: sai_kris_007
5 Replies

10. UNIX for Dummies Questions & Answers

Mail based on file size

Hi Friends, i am trying to write a shell script which will check for the logfile size. if the content of the logfile is wc -l >=1 then send mail with log file as attachment.else do nothing. i'm trying the below code can any one help on this if ] then (echo "`cat... (2 Replies)
Discussion started by: rajendragora
2 Replies
Login or Register to Ask a Question