pixelb / fslint

Linux file system lint checker/cleaner
314 stars 74 forks source link

Feature Request - Option to move instead of delete #136

Open RWL-69 opened 7 years ago

RWL-69 commented 7 years ago

Sometimes when going through old archives, it may be better to move files instead of deleting them for various reasons.

In my case, I would like to take all the duplicates and move them into an archive directory for further processing. In some cases, the duplicates need to be noted due to the file names are different than the other duplicates and need to be processed to clear up other issues. Some project may use the same file but with a different name and due ot modifications, this has created issues when just deleting duplicate files.

With the old name, it may be easier to fix outstanding issues.

Presently using fslint to find duplicates and then I am moving them manually.

pixelb commented 7 years ago

I might support this but would you want to copy all files to a single destination dir (in which case there would be conflicts for files with the same name), or copy the selected hierarchy to the destination?

Note FSlint already has the feature to save the list of selected files. If no files are selected it saves the full list, but if you first select files then only that subset is written out. Then you can process that with standard command line tools. For example, if you save the selected files to fslint.list.txt, then you could move to a backup like:

tr '\n' '\0' < fslint.list.txt | xargs -r0 cp --parents -a --target=/your/dest/dir &&
tr '\n' '\0' < fslint.list.txt | xargs -r0 rm
RWL-69 commented 7 years ago

In an ideal world, the move would be using "backup=t" for an option. Duplicate names are now resolved as they will be appended with the designated marker.

I can use "xargs" with "duff" to move all but one of a duplicate file from a series of directoires but it doesn't do it the way I would expect. At least with "fslint", I can select what files I want moved.

Presently working on a set of old archives with over 10,000 duplicates (when I started) of one sort or another. Some files I know that the duplicates can be deleted. Some I know that multiple copies are required until things are updated and left where they are. The list feature allows me to flag those files for future when there is more available time.