Cp files (>5 Mb size) from one directory to another


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Cp files (>5 Mb size) from one directory to another
# 1  
Old 05-14-2008
Cp files (>5 Mb size) from one directory to another

Hi All,
I have a requirement like below,
I want to transfer few file of size > 5 Mb from one directory to anotehr directory. Please let me know the command how can i do that

Sorry if it looks silly

Senthil
# 2  
Old 05-14-2008
Quote:
Sorry if it looks silly
Why do you think this?
# 3  
Old 05-14-2008
The mv command should be fairly agnostic to the sizes of the files. If you are moving from one file system (mount point) to another and the destination has issues with large files, you might get weird error messages, but that would be like when you are talking gigabytes.
# 4  
Old 05-14-2008
are those files in the same filesystem ? across NFS ?

did you consider using " mv " instead of copying and deleting ?
# 5  
Old 05-14-2008
yes. they are in same file system..
please let me know how can i use mv command so that all files with > 5Mb size automatically to new directory.
also there are lot many files
# 6  
Old 05-14-2008
There are various variants of the find command, but see if the following finds the files you want for a start.

Code:
find path/to/directory -type f -size +5000

These forums are full of examples of how to use find; search for find mv for some good examples.
# 7  
Old 06-12-2008
copying files

Hi,


If the files in the same directory you can use one of these comands:


go to the path where is the file is located by cd comand


then do
cp [the path] [the file name [the pathe where you want to keep][the file name]
you can also use mv in the same way
If the files are in different filesystems you have to use:
FTP comand

good luck
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to check total files size in hdfs directory?

Is there a way to calculate the total file size of HDFS file directory in GB or MB? I dont want to use du/df command. Without that is there a way HDFS Directory - /test/my_dir (1 Reply)
Discussion started by: rohit_shinez
1 Replies

2. Homework & Coursework Questions

Sorting files by size in another directory

1. The problem statement, all variables and given/known data: I'm trying to use a directory path to enter a new directory and sort the files there. I'm using the language C with a system call in Unix to sort the files from smallest to largest. 2. Relevant commands, code, scripts, algorithms:... (1 Reply)
Discussion started by: TedFTW
1 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 get the set of files size as a sum in a directory.

Hi, Can someone help me to get the complete files size (sum) over a perod time (1 day,2days)in a directory. eg: Directory :ABC I have a1,a2,a3 files are created in last 24 hours so I need to get the some of all these files. I am using the below find command but its giving me the... (1 Reply)
Discussion started by: gaddamja
1 Replies

5. Shell Programming and Scripting

How to traverse directory structure and sum size of files?

How do I write a bash or ruby or perl or groovy script to print all the files in my directory tree that are one-to-two years old, the size of each file, and the sum of file sizes and then delete them? I was using find . -atime +365 -exec rm '{}' \; but the problem was that I could not... (5 Replies)
Discussion started by: siegfried
5 Replies

6. Shell Programming and Scripting

Getting the total file size for certain files per directory

Hi, I am trying to get the total file size for certain files per directory. I am using find /DirectoryPath -name '*.dta' -exec ls -l {} \; | awk '{ print $NF ": " $5 }' > /users/cergun/My\ Documents/dtafiles.txt but this lists all the files in the directories. I need the total... (9 Replies)
Discussion started by: cergun
9 Replies

7. Shell Programming and Scripting

Just listing size, timestamp & name of files in a directory

How can I list the files in a directory and just show the file size, date stamp, timestamp and file name.. I've been trying to ls -lrt the directory to a file and then use the cut command but I'm not having any luck with getting the proper results.. I thought i could use the -f switch and count... (4 Replies)
Discussion started by: Jazmania
4 Replies

8. UNIX for Dummies Questions & Answers

listing files in a directory in bases of size

Hi , I want to list all files in the order of size . Just want to know which files occupies more size and which occupies less size . Is it possible with ls command ? :) Thanks, Arun. (1 Reply)
Discussion started by: arunkumar_mca
1 Replies

9. Shell Programming and Scripting

files of size 0 need to be deleted inside a directory

Hiiii, I have written a script which takes backup of some log files. let say the backuplocation is --- /abc/backuplocation -rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt23994.log -rw-r--r-- 1 webmut2 spgroup 0 Jan 27 02:41 ansrpt3601.log -rw-r--r-- 1... (2 Replies)
Discussion started by: namishtiwari
2 Replies

10. Shell Programming and Scripting

How to check if 3 files have same size in directory

I need to determine if any three files have the same file size in a specified directly? I have got as far as listing the file sizes but where to go from here? ls -al |sort -n -r +4 | awq '{print $5}' Thanks in anticipation (5 Replies)
Discussion started by: oggle
5 Replies
Login or Register to Ask a Question