Computing.Net > Forums > Unix > how to find files and move to direc

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.

how to find files and move to direc

Reply to Message Icon

Name: bryan lee
Date: April 7, 2003 at 15:12:00 Pacific
OS: windows xp pro
CPU/Ram: 256
Comment:

How do you find files, then copy the files into an existing directory. I am to find files starting with N which is not more than 10 days old, then copy the N files into an existing N directory. All in single command. The problem now is I don't know how to move the files into an existing directory.
find N* -mtime -10

then move into an existing directory


Directory is users/students/280501/kl004358/cprogram/N

this code cannot be use
find . -name 'N*' -mtime -10 -exec mv {} N/ \;
error message prompt out find: -exec not terminated with ';'
by the way,whats the meaning N/\;




Sponsored Link
Ads by Google

Response Number 1
Name: David Perry
Date: April 7, 2003 at 16:33:51 Pacific
Reply:

find . -name 'N*' -mtime -10 -exec mv {} N/ \

You need to have a space preceeding the \;

-exec mv {} N/

The {} is a substitute for what is returned by the find command. -exec mv {} N/ say to execute the move command on the results and move to the N directory.


0

Response Number 2
Name: bryan lee
Date: April 7, 2003 at 22:19:15 Pacific
Reply:


thanks,
but i still cannot execute the command.
can i have the full command line.


0

Response Number 3
Name: David Perry
Date: April 8, 2003 at 09:21:38 Pacific
Reply:

I don't understand. Are you saying you cannot execute "find" because it is not in your path?


0

Response Number 4
Name: bryan lee
Date: April 8, 2003 at 09:56:34 Pacific
Reply:

my question is Find all files in my home directory newer than 10 days and with names starting with N and copy these files into a directory called back up
the directory name is /users/students/200104/dh006834/backup.

i type your command exactly the same.but this message come out -exec not terminated with ';'


0

Response Number 5
Name: David Perry
Date: April 9, 2003 at 05:42:50 Pacific
Reply:

Sorry, I didn't notice how this forum mangled my reponse. Yes, anything other than a simple find needs to end with a backslash then semi-colon. There should have been a ";" at the end of the find command I posted.


0

Related Posts

See More



Sponsored Link
Ads by Google
Reply to Message Icon






Post Locked

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


Go to Unix Forum Home


Sponsored links

Ads by Google


Results for: how to find files and move to direc

Find, copy and move into directory www.computing.net/answers/unix/find-copy-and-move-into-directory/4508.html

How to find file older than 4 hours www.computing.net/answers/unix/how-to-find-file-older-than-4-hours/5145.html

To find files with different ending www.computing.net/answers/unix/to-find-files-with-different-ending/7943.html