Computing.Net > Forums > Linux > File size checking-Help

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

File size checking-Help

Reply to Message Icon

Name: mayen007
Date: February 12, 2007 at 06:26:32 Pacific
OS: linux
CPU/Ram: --
Product: --
Comment:

Plz help me anyone ,i am new to linux env,
I wanna implement script ,that will check a directory if any files in that directory with filesize > 0 bytes,then i need to move the files to some other directory..

let say,
/app/err/ folder have some files with some content also zero bytes files .In this case i want to move valid files to app/in/ folder not the zero bytes files.

thaks in advance..

best rgds,
mayen



Sponsored Link
Ads by Google

Response Number 1
Name: nails
Date: February 12, 2007 at 06:49:01 Pacific
Reply:

Replace olddir with your folder name. BTW, it's called a directory in linux/unix.

#!/bin/bash

# no error checking
find olddir -type f ! -size 0 -print|while read file
do
mv "$file" newdir
done


0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Linux Forum Home


Sponsored links

Ads by Google


Results for: File size checking-Help

LimeWire download file size www.computing.net/answers/linux/limewire-download-file-size/14852.html

error in file system check www.computing.net/answers/linux/error-in-file-system-check/27956.html

file-size limit in 'ext3' www.computing.net/answers/linux/filesize-limit-in-ext3/23344.html