Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error = find: -exec: no terminating ";" or "+"

I am looking for some help trying to get a command working. I want to find some files only and move them, but when I enter this command:

find /Volumes/NEXSAN/Engine\ Folders/Input/DTO_Proxy/* -type f -mtime +7 -exec mv -v {} /Volumes/NEXSAN/.2BeDeleted4realz/

I get this error

find: -exec: no terminating ";" or "+"

I know I probably have it wrong, but I can't figure out what's missing?

like image 944
user2983956 Avatar asked Aug 05 '14 15:08

user2983956


2 Answers

Just terminate the find command with \;, making sure to include the space before the \;.

find /Volumes/NEXSAN/Engine\ Folders/Input/DTO_Proxy/* -type f -mtime +7 -exec mv -v {} /Volumes/NEXSAN/.2BeDeleted4realz/ \;
like image 177
Avinash Raj Avatar answered Nov 17 '22 18:11

Avinash Raj


If you want to correct the find command that you had, it should look like this:

find . -name '*.xml' -exec SetFile -t TEXT {} \;

The *.xml needs to be quoted so it's passed as a parameter to find instead of expanded by the shell. The ; also needs to be escaped so it's passed as part of the parameter to find and not interpreted by the shell.

Keep in mind this will only work for files within the current directory (and subdirectories) and for any new files created, you would need to run the command again.

like image 4
Michael Mior Avatar answered Nov 17 '22 20:11

Michael Mior