1

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?

I'll-Be-Back
  • 693
  • 3
  • 9
  • 24

2 Answers2

2

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 :)

rvs
  • 4,027
  • 1
  • 25
  • 30
0

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.

womble
  • 95,029
  • 29
  • 173
  • 228