nixCraft Linux Forum

nixCraft

Linux / UNIX Tech Support Forum

moving files based on size

This is a discussion on moving files based on size within the Shell scripting forums, part of the Development/Scripting category; A small query. How do i solve this in bash? " move all files from folder1 to folder 2 who ...

Register free or login to your existing account and remove all advertisements.


Go Back   nixCraft Linux Forum > Development/Scripting > Shell scripting

Linux answers from nixCraft.


Shell scripting You can discuss the shell scripting, request shell scripts and scripting techniques

Reply

 

LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 11-01-2005, 11:44 AM
Junior Member
User
 
Join Date: Sep 2005
OS: suse/redhat
Posts: 24
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
kavi
Default moving files based on size

A small query. How do i solve this in bash?
" move all files from folder1 to folder 2 who size is less than 250 Kb, which were created by october 25 and which were created by user 1"
Reply With Quote
  #2 (permalink)  
Old 11-02-2005, 04:56 AM
Zaf
Guest
 
Posts: n/a
Default

Dont think you need a script for that:

find /folder1/* -user 1 -ctime +6 -size -250k | xargs -i mv {} /folder2/

hth
Zaf
Reply With Quote
  #3 (permalink)  
Old 11-11-2005, 06:17 PM
Guest
 
Posts: n/a
Default

Well Zaf is right. you can try script using zaf's command

Code:
files=$(find /folder1/* -user 1 -ctime +6 -size -250k)
dir="folder2"
for f in $files
do
  mv $f $dir
done
Above script can be use to do more stuff
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads

Thread Thread Starter Forum Replies Last Post
Adsl router security in Lan based network Wolverine Computer Networking and Internet/broadband 0 09-29-2007 01:26 AM
Script to Display Image size, Res, and Compression TiredOrangeCat Shell scripting 4 02-13-2007 12:04 AM
How to increase the vmalloc size? warren Linux software 1 09-11-2006 01:59 PM
Linux command to check size of hard drive disk gbdood Linux software 2 08-27-2006 10:44 AM
Need help on moving files and something else karabaja Shell scripting 12 08-25-2006 05:28 PM


All times are GMT +5.5. The time now is 10:46 AM.


Powered by vBulletin® Version 3.8.4 - Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.2
©2005-2009 nixCraft. All rights reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38