Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Everyday new audio files are created in dir1.

Sometime I move (mv) some files from dir1 to dir2

I want to delete all the files in dir2 that was moved before 20th June

Is this possible?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

I don't agree with first answer: it seems it's possible. mv preserves mtime (modification time), but it changes ctime (change time). So it's should be possible to archieve this by doing find dir2 -ctime +30 -delete (or whatever other expression with ctime).

PS: and don't forget to double-check your command by running it with -print instead of -delete :)

share|improve this answer
add comment

No, this isn't possible, because mv preserves the original mtime of the file when it's moved, so there's no record (within the file metadata) of when a file was moved.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.