LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-09-2008, 10:47 AM   #1
SmurfGGM
Member
 
Registered: Jul 2008
Posts: 49

Rep: Reputation: 0
Find files in current directory, not subdirectories


I have files in a directory that I want to move to an archive directory. ie

/report/*.rtn
archive to ..
/report/archive/*.rtn

The report directory also contains sub-directories, ie ..

/report/fish/*.rtn
/report/teeth/*.rtn

.. I dont want to archive those files.

If I run this command ..

find *.rtn -mtime +60

.. it lists all the files I want to move to archive.

If I use it within 'for', it lists EVERY file and sub-directory ..

for file in `find *.rtn -mtime +60`

I'm sure this is easy !
 
Old 10-09-2008, 12:14 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Maybe something like:
Code:
find /report -maxdepth 1 -mtime +60 -name \*.rtn
see man find for future reference.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
move all files in current directory into a subdirectory in the current directory jakykong Linux - Newbie 8 07-16-2013 11:46 PM
Using Bash, Find script files in a directory or subdirectories within... ray5_83 Programming 4 10-10-2008 07:42 PM
how to find files in current directory only (not recursively) babu198649 Linux - Newbie 2 12-27-2007 01:30 AM
Bash Expression: Current Directory & All Subdirectories Below gmcauley Programming 2 01-01-2007 02:36 PM
Copying all files from subdirectories into one directory Hegemon Linux - General 3 01-17-2005 11:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration