Files by size


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users Files by size
Prev   Next
# 1  
Old 07-02-2018
Files by size

I am new to Unix and need help. I have several files of different sizes Example: 1 GB , 2GB , 500 mb ,200mb and even small sizes. What I want is I want to pick files and sum of the combined file size should be less than 3 Gb and move them to a different directory. when I do ls -ltr I want to pcik files of size 3 GB (files sizes combined it could be 2 files or 3 files or 30 files but should be less than 3 GB ). every time the script should pick up files less than 3 GB . For any reason there are only 5 files and the total size is less than 3 Gb then all those files should be picked and moved as well. We are in AIX unix Please let me know if you need more information. Thank you in advance for your help.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Files by size

I am new to Unix and need help. I have several files of different sizes Example: 1 GB , 2GB , 500 mb ,200mb and even small sizes. What I want is I want to pick files and sum of the combined file size should be less than 3 Gb and move them to a different directory. when I do ls -ltr I want... (5 Replies)
Discussion started by: pyarigreat
5 Replies

2. Shell Programming and Scripting

Files have same size

Hello, I want remove files have same size in a directory. this command only find this files. ls -l | awk '$1!~/^d/{if(size!=""){ print}size=$8}' I want to remove the files of the same size. samples: 5 files are same size. I want to keep only first file. Thank you very much for your help. (3 Replies)
Discussion started by: hoo
3 Replies

3. Shell Programming and Scripting

How to delete some of the files in the directory, if the directory size limits the specified size

To find the whole size of a particular directory i use "du -sk /dirname".. but after finding the direcory's size how do i make conditions like if the size of the dir is more than 1 GB i hav to delete some of the files inside the dir (0 Replies)
Discussion started by: shaal89
0 Replies

4. UNIX for Dummies Questions & Answers

How to list files which have same size?

Hi guys, I need to do 100 files comparison after I sorted the files. There are no specific key for sorting so i plan to arrange the files based on the file size. The command that i used to sort the files by size is as per below:- ls -l | sort +4rn | awk '{print $5, $9}' The problem that i... (3 Replies)
Discussion started by: shahril
3 Replies

5. UNIX for Dummies Questions & Answers

copy only new files or files of a different size

hello i would like to copy files from 1 location to a nother, but it has only to copy files which are newer or have a different filesize. all has to be logged to a copy.log file (als skipped files should be in the log) is this possible with the cp command (1 Reply)
Discussion started by: arnoldg
1 Replies

6. Shell Programming and Scripting

Merge files of differrent size with one field common in both files using awk

hi, i am facing a problem in merging two files using awk, the problem is as stated below, file1: A|B|C|D|E|F|G|H|I|1 M|N|O|P|Q|R|S|T|U|2 AA|BB|CC|DD|EE|FF|GG|HH|II|1 .... .... .... file2 : 1|Mn|op|qr (2 Replies)
Discussion started by: shashi1982
2 Replies

7. Shell Programming and Scripting

This script cut size of files "Lol" change string in files

Basic: find . -type f -name “*.txt” -print | awk '{gsub("Ontem", "AntesdeOntem", $0); print > FILENAME}' *.txt The idea is in folder /home/myapontamentos I have some files and i need to change in all them the word "ontem" to "antesdeontem". But bigger files are cut (size i mean)... (4 Replies)
Discussion started by: single
4 Replies

8. Shell Programming and Scripting

size of files

hello Experts,can any one tell me that i have a folder data in linux. and there are three files A,B,C in the directory. cany any one tell me the command that which can tell me how much space is occupied by each file and its free space also for example FILES USED SPACE FREE SPACE A ... (1 Reply)
Discussion started by: shary
1 Replies

9. Shell Programming and Scripting

bash script working for small size files but not for big size files.

Hi, I have one file stat. Stat file contents are as follows: for example. H50768020040913,00260100,507680,13,0000000643,0000000643,00000,0000 H50769520040808,00260100,507695,13,0000000000,0000000000,00000,0000 H50770620040611,00260100,507706,13,0000000000,0000000000,00000,0000 Now i... (1 Reply)
Discussion started by: davidpreml
1 Replies

10. UNIX for Dummies Questions & Answers

sort files by size

Is there a way to sort files by size using the ls command? thanks in advance (1 Reply)
Discussion started by: AMD
1 Replies
Login or Register to Ask a Question
NEWFS_HFS(8)						    BSD System Manager's Manual 					      NEWFS_HFS(8)

NAME
newfs_hfs -- construct a new HFS Plus file system SYNOPSIS
newfs_hfs [-N] [-U uid] [-G gid] [-M mask] [-P] [-s] [-b block-size] [-c clump-size-list] [-i first-cnid] [-J [journal-size]] [-D journal-device] [-n node-size-list] [-v volume-name] special newfs_hfs -N partition-size [-U uid] [-G gid] [-M mask] [-P] [-h | -w] [-s] [-b block-size] [-c clump-size-list] [-i first-cnid] [-J [journal-size]] [-D journal-device] [-n node-size-list] [-v volume-name] DESCRIPTION
Newfs_hfs builds an HFS Plus file system on the specified special device. Before running newfs_hfs the disk should be partitioned using the Disk Utility application or pdisk(8). The file system default parameters are calculated based on the size of the disk partition. Typically the defaults are reasonable, however newfs_hfs has several options to allow the defaults to be selectively overridden. The options are as follows: -N [partition-size] Causes the file system parameters to be printed out without really creating the file system. If the argument following the -N starts with a decimal digit, it is assumed to be a partition size. The paritition size may be given in decimal, octal (with leading `0'), or hexadecimal (with leading `0x'). The partition size argument can be specified in 512-byte blocks (with a `b' suffix), petabytes (`p' suffix), terabytes (`t' suffix), gigabytes (`g' suffix), megabytes (`m' suffix), or kilobytes (`k' suf- fix). All suffixes indicate binary, not decimal, multipliers (e.g., `1k' is 1024 bytes). If no suffix is specified, the value is assumed to be in bytes; if an illegal suffix is specified, it results in a size of 0 bytes. If the partition size is given, then no special device argument shall be provided. If no partition size is given, then the size of the given special device is used instead, and the special device will not be written to. -U uid Set the owner of the file system's root directory to uid. -G gid Set the group of the file system's root directory to gid. -M mask Specify the octal access permissions mask for the file system's root directory. -P Set kHFSContentProtectionBit in the volume's attributes, which will cause the volume to be mounted with the "protect" option if the kernel supports it. -s Creates a case-sensitive HFS Plus filesystem. By default a case-insensitive filesystem is created. Case-sensitive HFS Plus file systems require a Mac OS X version of 10.3 (Darwin 7.0) or later. -b block-size The allocation block size of the file system. The default value is 4096. -c clump-size-list This specifies the clump and/or initial sizes, in allocation blocks, for the various metadata files. Clump sizes are specified with the -c option followed by a comma separated list of the form arg=blocks. Example: -c c=5000,e=500 a=blocks Set the attribute file clump size. b=blocks Set the allocation bitmap file clump size. c=blocks Set the catalog file clump size. d=blocks Set the data fork clump size. e=blocks Set the extent overflow file clump size. r=blocks Set the resource fork clump size. -i first-cnid This specifies the initial catalog node ID for user files and directories. The default value is 16. -I initial-size-list This specifies the initial size, in allocation blocks, for the various metadata files. Initial sizes are specified with the -I option followed by a comma separated list of the form arg=blocks. Example: -I c=5000,e=500 a=blocks Set the initial attribute file size. c=blocks Set the initial catalog file size. e=blocks Set the initial extent overflow file size. -J [journal-size] Creates a journaled HFS+ volume. The default journal size varies, based on the size of the volume. Appending an 'M' to the journal size implies megabytes (i.e. 64M is 64 megabytes). The maximum journal size is 1024 megabytes. -D journal-device Creates the journal on special device journal-device. -n node-size-list This specifies the b-tree node sizes, in bytes, for the various b-tree files. Node sizes are specified with the -n option fol- lowed by a comma separated list of the form arg=bytes. The node size must be a power of two and no larger than 32768 bytes. Example: -n c=8192,e=4096 a=bytes Set the attribute b-tree node size. c=bytes Set the catalog b-tree node size. e=bytes Set the extent overflow b-tree node size. -v volume-name Volume name (file system name) in ascii or UTF-8 format. SEE ALSO
mount(8), pdisk(8) HISTORY
The newfs_hfs command appeared in Mac OS X Server 1.0 . As of Mac OS X 10.6, this utility no longer generates HFS standard file systems. Mac OS X June 19, 2008 Mac OS X