07-03-2018
Yes the intent is to move the oldest file and select more files until you get as close as possible to 3GB even if some of the selected files are not the oldest files in the directory and just think there are 20 files and total combined size is 2 GB then we want all the files to be moved as well.
By 3 GB I mean 3 * 1000 * 1000 * 1000 . Thank you for your help Don Appreciate it.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Is there a way to sort files by size using the ls command?
thanks in advance (1 Reply)
Discussion started by: AMD
1 Replies
2. Shell Programming and Scripting
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
3. Shell Programming and Scripting
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
4. Shell Programming and Scripting
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
5. Shell Programming and Scripting
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
6. UNIX for Dummies Questions & Answers
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
7. UNIX for Dummies Questions & Answers
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
8. Shell Programming and Scripting
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
9. Shell Programming and Scripting
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
10. UNIX for Advanced & Expert Users
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... (1 Reply)
Discussion started by: pyarigreat
1 Replies
DU(1) FSF DU(1)
NAME
du - estimate file space usage
SYNOPSIS
du [OPTION]... [FILE]...
DESCRIPTION
Summarize disk usage of each FILE, recursively for directories.
Mandatory arguments to long options are mandatory for short options too.
-a, --all
write counts for all files, not just directories
-B, --block-size=SIZE use SIZE-byte blocks
-b, --bytes
print size in bytes
-c, --total
produce a grand total
-D, --dereference-args
dereference FILEs that are symbolic links
-h, --human-readable
print sizes in human readable format (e.g., 1K 234M 2G)
-H, --si
likewise, but use powers of 1000 not 1024
-k like --block-size=1K
-l, --count-links
count sizes many times if hard linked
-L, --dereference
dereference all symbolic links
-S, --separate-dirs
do not include size of subdirectories
-s, --summarize
display only a total for each argument
-x, --one-file-system
skip directories on different filesystems
-X FILE, --exclude-from=FILE
Exclude files that match any pattern in FILE.
--exclude=PATTERN Exclude files that match PATTERN.
--max-depth=N
print the total for a directory (or file, with --all) only if it is N or fewer levels below the command line argument;
--max-depth=0 is the same as --summarize
--help display this help and exit
--version
output version information and exit
SIZE may be (or may be an integer optionally followed by) one of following: kB 1000, K 1024, MB 1,000,000, M 1,048,576, and so on for G, T,
P, E, Z, Y.
PATTERNS
PATTERN is a shell pattern (not a regular expression). The pattern ? matches any one character, whereas * matches any string (composed of
zero, one or multiple characters). For example, *.o will match any files whose names end in .o. Therefore, the command
du --exclude='*.o'
will skip all files and subdirectories ending in .o (including the file .o itself).
AUTHOR
Written by Torbjorn Granlund, David MacKenzie, Larry McVoy, and Paul Eggert.
REPORTING BUGS
Report bugs to <bug-coreutils@gnu.org>.
COPYRIGHT
Copyright (C) 2002 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU-
LAR PURPOSE.
SEE ALSO
The full documentation for du is maintained as a Texinfo manual. If the info and du programs are properly installed at your site, the com-
mand
info du
should give you access to the complete manual.
du (coreutils) 4.5.3 February 2003 DU(1)