Unable to delete file: Argument list too long

Last update on December 2, 2008 05:34 AM by deri58
Published by deri58

Unable to delete file: Argument list too long






When trying to delete a file , you receive the following error message :

bash: /bin/rm: Argument list too long

This is due to a limitation of the command rm which cannot manage a large number of arguments (The joker ‘*’ is developed by the shell in a series of arguments).

Solutions


Xargs


Send each rm argument using the command xargs as below:
ls *.filename | xargs rm
find . -type f -name \*.filename | xargs rm

Command find


The second solution consists of using the command find together with –exec:
find . -name "*.filename" -exec rm {} \;

loop for (bash)


Another solution consists of performing a loop in shell script:

for i in `seq 0-9`a b c d e f g h i j k l m n o p q r s t u v w x y z ; do rm $i*.toto ; done

Program Perl


using the command Perl :
perl -e 'for(</home/lami20j/*.toto>){unlink}'
Best answers for « Unable to delete file: Argument list too long » in :
Permanently delete files from trash bin Show Permanently delete files from trash Sometimes when emptying the trash some files stays and refused to be deleted! You just have to use a command: Start the Terminal - Type "sudo rm • • •-R" - Drag files, folders that you want...
How to restore deleted files Show How to restore deleted files Download a recovery tool There are easy and effective recovery tools available for download on the web and some have the major advantage of being free. Zero Assumption Recovery Download Link: http://www.z-a...
[Ubuntu]Preventing recovery of deleted files Show [Ubuntu]Preventing recovery of deleted files Here below is a simple method, on how preventing the recovery of deleted files: First, make sure the recycle bin of Nautilus (the file browser) is empty. Right click on it and choose the...
Unable to delete the file MozMapi32.dll ShowUnable to delete the file MozMapi32.dll Solutions When trying to uninstall Thunderbird on your computer, the following error message on your computer : Unable to delete MozMapi32.dll. During re-installation of Thunderbird on your...
MacOS X: Delete obstinate Files ShowMacOS X: Delete obstinate Files It may happens sometimes when trying to empty the recycle bin and that the files or folders you want to delete it still refuses to disappear. To resolve this problem, use a UNIX command in Terminal....
[Sed] Delete one or more lines from a file Show[Sed] Delete one or more lines from a file Removing one (or several) line (s) of a file Syntax: sed '{[/]||[/]}d' sed '{[/][,][/]d' /.../=delimiters n = line number...
Download Recover Deleted Fat File 2 ShowRecover Deleted Fat File is a recovery tool for hard disks. It allows to restore damaged, corrupt, formatted, overwritten, deleted files. The application supports the following file systems: FAT12, FAT16, FAT32, SATA, ATA, SCSI and the following...
Download Recover Files ShowIs not he you ever a file of your hard or worse disk of a detachable disk succeeds to abolish by guard? Recover Lines as his name points it out a tool allowing the recovery is of files to abolish.It works even if you have already cleaned the hamper,...
Download NTFS Undelete ShowNTFS Undelete is a free software allowing to recover deleted files. It recovers the files directly from the hard disk, even if the recycle bin has been emptied.
UNIX Commands ShowTable of the main UNIX commands Unix Commands Description Options ls lists the content of a directory -a Displays all files, including hidden files -I Displays a...
Linux - User management ShowFirst step for the administrator When several people have access to a system, the administrator must manage the users. To do so, he must know the common commands and files to be configured. The important files are: the /etc/passwd file the...
UNIX - Files ShowIntroduction to UNIX files In UNIX systems any element is represented in the form of a file. All files are architectured around a single tree structure where the base, called the root, is written "/". File types UNIX systems define different...