|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
look for file size greater than "0" of specific pattern and move those to another directory
Hi ,
i have some files of specific pattern ...i need to look for files which are having size greater than zero and move those files to another directory.. Ex... abc_0702, abc_0709, abc_782 abc_1234 ...etc need to find out which is having the size >0 and move those to target directory.. Thanks in advance.. Siva Santosh |
| Sponsored Links | ||
|
|
#2
|
||||
|
||||
|
Code:
man test |
| Sponsored Links | ||
|
|
#3
|
|||
|
|||
|
To get you started, first check that you can find the files with a command like this: Code:
find /dir/subdir -type f -name 'abc_*' -size +0 -print Please post you Operating System and version and what Shell you use. As @elixir_sinari implies there could be a pure Shell approach using file pattern matching and the test -s command . If you need to search the tree, find is preferred. I you need further help, please remember to describe your directory tree. |
|
#4
|
|||
|
|||
|
A small correction to the end would help. Code:
find /dir/subdir -type f -name 'abc_*' -size +0 -exec mv {} target_dir \;Last edited by PikK45; 07-06-2012 at 03:28 PM.. Reason: bad code |
| The Following User Says Thank You to PikK45 For This Useful Post: | ||
dssyadav (07-06-2012) | ||
| Sponsored Links | |
|
|
#6
|
|||
|
|||
|
Thank you all,
|
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
@methyl
I couldn't get you!! |
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Difference in file size between "ls -l" and "du -a" | jgt | SuSE | 1 | 06-04-2012 08:27 AM |
| replace "," with "." only in specific columns of a file? | Unilearn | UNIX for Dummies Questions & Answers | 8 | 08-08-2011 12:06 PM |
| awk command to replace ";" with "|" and ""|" at diferent places in line of file | shis100 | Shell Programming and Scripting | 7 | 03-16-2011 08:59 AM |
| Delete files older than "x" if directory size is greater than "y" | JamesCarter | Shell Programming and Scripting | 4 | 02-11-2010 07:41 AM |
| "sed" to check file size & echo " " to destination file | jockey007 | Shell Programming and Scripting | 7 | 04-28-2009 02:08 AM |
|
|