![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| need to move find results | pimentelgg | Shell Programming and Scripting | 9 | 12-20-2007 06:00 PM |
| Find, Append, Move & Rename Multiple Files | Trapper | Shell Programming and Scripting | 5 | 08-30-2007 07:39 AM |
| Find, make and move file based on username | Helmi | UNIX for Dummies Questions & Answers | 5 | 04-19-2007 09:49 PM |
| How to do a move in FTP | steiner | Shell Programming and Scripting | 3 | 06-29-2005 11:15 AM |
| find move | saswerks | Shell Programming and Scripting | 4 | 02-24-2005 04:48 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
find and move
Hello I am new to this board.
I was looking for a one line command to find the oldest 10,000 files in a directory and move them. I tried such things as: find . -type f | ls -ltr | head -n 10000 -exec mv {} directory/ \; find . -type f | ls -ltr | head -n 50 | xargs mv directory/ \; I could create a list and find the 10001 st file and use ! -newer or a for loop but there must be a one line solution. Thanks in advance Natasha |
|
||||
|
Erroring out ~~
I'm using this following command but its erroring out !!
find /home/xxx/yyy/ . -mtime -7 -type f -exec mv {} /home/xxx/yyy/zzz/ " find: 0652-018 An expression term lacks a required parameter. " -- This is the error i get... My basic requirement here is to move files which are 7 days old !!... I have tried at the prompt also giving same command but same error is popping up. please suggest what might be the problem here.. |
|
||||
|
I might be wrong, but I don't think /usr/bin/find is needed to accomplish what OP wanted:
ls -lrt (or, alternatively "-1rt") gives a list of files sorted ascendingly by modification date, therefore: ls -1rt | head -10000 | while read file ; do mv $file /somewhere/else ; done should do the trick. If there are subdirectories and these should be excluded things get a bit more complicated. Replace the "ls -1rt" above with: ls -lrt | grep "^-" | sed 's/[<space><tab>][<space><tab>]*/<space>/g' | cut -d' ' -f9 I concede, the second is a bit of a stretch of a "one-liner". Replace "<space>" and "<tab>" with literal tabs and spaces respectively. bakunin |
|
||||
|
why is "find" SUPER fast on ubuntu and not on cygwin
I have a directory tree on my ubuntu which consists of 15000 files and 8Gig of space.
At the command line, I put in: time find "*.gz" and it comes back with a response in less than 0.1 seconds. I do the same thing on my cygwin system and it takes much longer. My personal machine is much faster. Quad core machine, etc... Unless I am fooling myself, I am seeing 2000 to 10000 times faster. any thoughts would be appreciated. |
![]() |
| Bookmarks |
| Tags |
| mtime |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|