Live Chat!

rm complains argument list too long

* * * * * 2 votos

October 20th, 2007 mysurface

There is a limitation of rm command, where you can’t delete a large groups of files with *. For examples,
rm -rf something*
If there are large amount of files initiate with something, rm will fails and complains
/bin/rm: Argument list too long.
The solution is to make use of find, xargs and rm.
find . -name ’something*’ -print0 | [...]

Posted in Common, find, rm, xargs | Hits: 13875 | 5 Comments »

How to manipulate files with name like ‘-life.mp3′

* * * *   1 votos

March 21st, 2007 mysurface

Sometimes, you may find some file you can’t delete because of the filename begins with minus(-). LBE have that example on the post “Remove file start with special character”, as simple as this
rm ./-life.mp3
The same way you can manipulate those files by mv, cp etc. The important highlights here is ./
dot(.) is actually means current [...]

Posted in Common, mplayer, mv, rm | Hits: 12495 | 3 Comments »

Remove all .svn directories at once

* * * * ½ 2 votos

January 19th, 2007 toydi

When you check out a project code base from a svn repository, each downloaded directory (from top to the deepest) contains a .svn hidden directory that keeps svn’s necessary metadata.
If you want to remove them all at once, here’s one way to do it:
~/project_dir $> find -name .svn -print0 | xargs -0 rm -rf
find [...]

Posted in Common, find, rm, xargs | Hits: 18697 | 4 Comments »

Remove file start with special character

          0 votos

December 5th, 2006 mysurface

In linux, file can be any name, including “–testing”. If you have a file with this name, how you delete it?
Command line bellow will fail,
rm –testing
The correct one is
rm ./–testing
This works for mv, cp etc. So you can actually create a file with name “–testing” using touch.
touch ./–testing
Related PostsHow to manipulate files with name like [...]

Posted in Common, mv, rm, touch | Hits: 10265 | 3 Comments »

remove directory

* *       1 votos

September 26th, 2006 mysurface

rmdir is like a reverse of mkdir, it removes the empty directory.
To remove an empty directory call hello, just
rmdir hello
And you can remove parent directory as well like
rmdir -p lvl1/lvl2/hello
It will removes the directory lvl1 then sub dir lvl2 and sub sub dir hello
But to use rmdir, the directory MUST be empty. So I found [...]

Posted in Common, Misc, rm, rmdir | Hits: 4694 | 1 Comment »