The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Sorting Files by date and moving files in date order rebel64 Shell Programming and Scripting 2 03-11-2008 12:45 PM
Create a list of files that were modified after a given date. rkka UNIX for Dummies Questions & Answers 4 01-22-2008 05:12 AM
How do I organize a series of files in date order? hedgehog001 UNIX for Dummies Questions & Answers 1 08-22-2005 11:04 PM
list of files in date order Jeannine UNIX for Dummies Questions & Answers 2 08-15-2005 02:19 PM
retain create/mod date and time of files jerardfjay Shell Programming and Scripting 5 06-15-2005 02:36 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-15-2006
mab_arif16 mab_arif16 is offline
Registered User
  
 

Join Date: May 2006
Posts: 14
Order files by create date

hi
Is there a way to sort files in the order they were created ,and move them to another directory one by one ,oldest being the first to be moved.
Thanks
Arif
  #2 (permalink)  
Old 05-15-2006
Klashxx's Avatar
Klashxx Klashxx is offline Forum Advisor  
HP-UX/Linux/Oracle
  
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 393
Code:
ls -tr|xargs -i ksh -c "mv {} ../tmp/"
Cheers
  #3 (permalink)  
Old 05-15-2006
mab_arif16 mab_arif16 is offline
Registered User
  
 

Join Date: May 2006
Posts: 14
Hi thanks for reply
I have like 5 files(*.txt) in the directory
I want to move only the oldest file in the order of creation to another directory .
I am trying to use
mv (ls -tr *.event |head -1) /arif/temp/ in bash shell
I need help to correct the syntax of this command if my idea is right .

Last edited by mab_arif16; 05-15-2006 at 12:57 PM..
  #4 (permalink)  
Old 05-15-2006
Klashxx's Avatar
Klashxx Klashxx is offline Forum Advisor  
HP-UX/Linux/Oracle
  
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 393
Ok ,use:
Code:
ls -tr *.txt|head -1|xargs -i ksh -c "mv {} ../tmp/"
  #5 (permalink)  
Old 05-15-2006
mab_arif16 mab_arif16 is offline
Registered User
  
 

Join Date: May 2006
Posts: 14
Thanks that was perfect
Arif
Sponsored Links
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On



All times are GMT -4. The time now is 09:58 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0