Tips tagged rm


3

Tip #823   Remove DS_Store files from shared folders

.DS_Store files are a hidden file created by OS X to store custom attributes of a folder such as the position of icons or the choice of a background image. By default, they are created in every folder accessed, even folders on remote systems (for example, folders shared over an SMB or AFP connection). This can soon leave your shared folders littered with these files.

The command below will remove all DS_Store files from the current directory and any sub directories.

Read more »

8

Tip #553   Remove duplicate files

The script below will find duplicate files (files with the same md5sum) in a specified directory and output a new shell script containing commented-out rm statements for deleting them. You can then edit this output to decide which to keep.

Read more »

2

Tip #468   Moved Trac and Subversion repositories to another machine/direct

CASE: You've relocated Subversion and Trac repositories to another machine/directories. You don't want to edit n+1 trac.ini files.

You have for example:
/repos/svn-myprojects/my-first-project
/repos/trac-myprojects/my-first-project

/repos/svn-myprojects/my-second-project
/repos/trac-myprojects/my-second-project

...etc...

Change ALL trac.ini repository_dir settings:

trac-mass-repodir-edit.sh:
Read more »

9

Tip #363   Finding log files X number of days old and deleteing them.

This is a script that I recently wrote to find the logs of my IDP that were over 90 days old and delete them.

The script is pretty much self explanatory.

Read more »

7

Tip #307   Delete old files

Use find by time to delete files more than x days old. For example the command below will delete files more than one day old:

find . -mtime +1 -exec rm {} \; Read more »

4

Tip #251   Argument list too long


ls | xargs rm

Sometime there are so many files in a directory than the rm command doesn't work
Read more »

59

Tip #232   Deleting difficult filenames

To delete a file who's file name is a pain to define (eg. ^H^H^H) find it's inode number with the command "ls -il". Use the line below to find and delete the file.
Read more »

14

Tip #189   Remove every file but one

It's easy to remove (or copy, move etc.) all files that match a given criteria, but harder to move all but ones excluded by a criteria.

To do this we can combine grep's -v option with Unix command substitution:

Read more »