dave111
dave111

Reputation: 305

Unix - arg list too long

Using bash 3.2. Trying to delete some log files older than 7 days...anyways this command works on another server but not on the current one.

Wondering if anyone can fix the syntax for me as I'm no Unix expert:

find /export/home1/dir1/dir2/sync/logs/* -mtime +7 -exec rm -f {} \;

Upvotes: 0

Views: 542

Answers (1)

anubhava
anubhava

Reputation: 784868

Remove * from path of find:

find /export/home1/dir1/dir2/sync/logs/ -mtime +7 -exec rm -f {} \;

or if you newer find version:

find /export/home1/dir1/dir2/sync/logs/ -mtime +7 -delete

By having * in path shell expands to all the available entries in the given directory.

Upvotes: 3

Related Questions