AOA,
I want to delete large # of files from
/d01/oracle/PROD/inst/apps/PROD_ebs/logs/appl/conc/out
The Size of the path is:
613M /d01/oracle/PROD/inst/apps/PROD_ebs/logs/appl/conc/out
Total # of files is: 76301
when i delete the files under /out directory:
it gives me error:
"Argument list is too long"
what is the issue or How can i resolve it.
Files Removes Issue
As the total number of files is too high that is why you are facing this error msg. Try deleting files by minimizing the number of files in deletion batch i.e. try deleting files 500 to 1000 at a time.
Or if you are damn sure what you are going to do try this command to delete all files in your desired location
find -name '*' | xargs rm
Or if you are damn sure what you are going to do try this command to delete all files in your desired location
find -name '*' | xargs rm
Registered Linux User # 511059
http://imranbhullar.blogspot.com
Follow me on Twitter! http://twitter.com/imranbhullar
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds
http://imranbhullar.blogspot.com
Follow me on Twitter! http://twitter.com/imranbhullar
"If 386BSD had been available when I started on Linux, Linux would probably never had happened." Linus Torvalds
better solution:read the man pages for what -print0 and -0 do.
Code: Select all
find /path/to/directory -type f -print0 | xargs -0 rm
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
you're still trying to delete using one command. that's what xargs helps you with. read its man page.
try this:it will not work with files that have spaces in them, and you might have to adjust $6 and $8 to something else. my ls -lU sayscolumn 6 is the date for me.
try this:
Code: Select all
cd /the/directory; ls -lU | grep '2011-01' | awk '$6 ~ /2011-01/ {print $8}' | xargs rm
Code: Select all
-rw-r--r-- 1 pkf pkf 4898 2011-04-25 16:14 tmpbxdueo
-rw-r--r-- 1 pkf pkf 372337 2011-03-11 17:38 update-log.12336
-rw-r--r-- 1 pkf pkf 376173 2010-11-01 16:13 update-log.20637
-rw-r--r-- 1 pkf pkf 1114 2011-04-06 07:55 stockjsvars.mako.pyc
-rw-r--r-- 1 pkf pkf 1510 2011-04-25 12:05 tmpwKsEx4
-rw-r--r-- 1 pkf pkf 15383 2009-11-10 16:46 update-log.11540
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Thanks, but my directory files are look like:
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 16:59 o70356816.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:00 o70357816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:00 o70350820.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:00 o70358818.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:00 o70359816.out
-rw-rw-r-- 1 applprod applprod 31760 Apr 25 17:01 o70360816.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:01 o70360817.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:01 o70361816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:01 o70360818.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:02 o70362816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:04 o70363816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:05 o70350816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:06 o70358817.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:11 o70364817.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:17 o70365816.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 16:59 o70356816.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:00 o70357816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:00 o70350820.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:00 o70358818.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:00 o70359816.out
-rw-rw-r-- 1 applprod applprod 31760 Apr 25 17:01 o70360816.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:01 o70360817.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:01 o70361816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:01 o70360818.out
-rw-rw-r-- 1 applprod applprod 31765 Apr 25 17:02 o70362816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:04 o70363816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:05 o70350816.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:06 o70358817.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:11 o70364817.out
-rw-rw-r-- 1 applprod applprod 0 Apr 25 17:17 o70365816.out
try doingbefore running ls.
Code: Select all
export LANG=en_US.UTF-8
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?